@datagouv/components-next 1.4.1-dev.1373.g379aceb6 → 1.4.1-dev.1375.ge1f9e509

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 (81) hide show
  1. package/assets/main.css +4 -0
  2. package/dist/{Control-CeBb5PEu.js → Control-DPuXeUqi.js} +3 -12
  3. package/dist/{Datafair.client-Ci2WOgAS.js → Datafair.client-LlEgG7WU.js} +2 -3
  4. package/dist/{Image-CBQwYbQB.js → Image-DVWRoLLI.js} +7 -22
  5. package/dist/{ImagePreview.client-B4RtxuiJ.js → ImagePreview.client-Db5dmxMP.js} +2 -3
  6. package/dist/{JsonPreview.client-r7swv2fp.js → JsonPreview.client-DKy2AexC.js} +4 -6
  7. package/dist/{Layer-BPuffNS-.js → Layer-D_5tYbVm.js} +7 -9
  8. package/dist/{Map-QeL96qbQ.js → Map-CTBJEae_.js} +937 -967
  9. package/dist/{MapContainer.client-CxH1a8Tn.js → MapContainer.client-Clk9_bbS.js} +13 -15
  10. package/dist/{OSM-DT4I7v8A.js → OSM-B5Zc3qAf.js} +2 -3
  11. package/dist/{PdfPreview.client-BjeMcqcy.js → PdfPreview.client-D3wHTDb9.js} +130 -378
  12. package/dist/{PdfSkeleton-CVZxJaeL.js → PdfSkeleton-nas5Pmia.js} +2 -3
  13. package/dist/{Pmtiles.client-D8idR2l7.js → Pmtiles.client-NGYdeSJY.js} +151 -350
  14. package/dist/{PreviewError-Cx7CItT_.js → PreviewError-EeaGx3SL.js} +399 -392
  15. package/dist/{PreviewWrapper-Cd1RSmS-.js → PreviewWrapper-BhldDdXK.js} +2 -3
  16. package/dist/{ScaleLine-Cwwk9wJo.js → ScaleLine-C_tuJ6VG.js} +3 -4
  17. package/dist/Tile-8nHSuqcv.js +571 -0
  18. package/dist/{Tile-4WpHaLOZ.js → Tile-Bu5lF4M5.js} +8 -13
  19. package/dist/{TileImage-CZZ4lgsm.js → TileImage-CgO5alXc.js} +105 -113
  20. package/dist/{View-DWqx4Jqr.js → View-Dad8DfSD.js} +25 -51
  21. package/dist/{XmlPreview.client-cSebx8br.js → XmlPreview.client-CmGbc3c3.js} +5 -7
  22. package/dist/assets/maplibre-gl-worker-CEzvAyZY.js +10 -0
  23. package/dist/components-next.css +1 -1
  24. package/dist/components-next.js +15585 -15914
  25. package/dist/components.css +1 -1
  26. package/dist/{en-C_qOt4Jn.js → en-OIaJCts4.js} +1 -2
  27. package/dist/{france-DPcdJc84.js → france-BtSQqcqV.js} +5 -9
  28. package/dist/{hvd-ZlsiTVFh.js → hvd-CTia2VCz.js} +1 -2
  29. package/dist/{inspire-DZQ-yA5f.js → inspire-Cc-Kc4K-.js} +1 -2
  30. package/dist/{leaflet-src-lLkzhpcP.js → leaflet-src-BY_Zq0V0.js} +77 -126
  31. package/dist/{proj-DM6GW1n3.js → proj-COhZ08DR.js} +19 -37
  32. package/dist/{purify.es-D6pPunDo.js → purify.es-CGAWnSTR.js} +4 -27
  33. package/dist/{rolldown-runtime-CEFd7nDs.js → rolldown-runtime-DsPmjQRF.js} +2 -3
  34. package/dist/{sl-BxQ_ZY_w.js → sl-CKkMwQhf.js} +1 -2
  35. package/dist/{spd-Cs37HjuR.js → spd-Djcs02gw.js} +1 -2
  36. package/dist/{sr-JDtennFO.js → sr-DabGmchD.js} +1 -2
  37. package/dist/{src-D_UE0st7.js → src-D_o-aUzl.js} +1612 -2428
  38. package/dist/{text-clamp.esm-DRvX2Gzm.js → text-clamp.esm-DE3022VR.js} +3 -5
  39. package/dist/{transform-Ct1GejD-.js → transform-CNeEnSK9.js} +7 -13
  40. package/dist/{vue3-json-viewer-BJgUfh-l.js → vue3-json-viewer-CUx5EFVA.js} +1 -2
  41. package/dist/{vue3-xml-viewer.common-DbJwzvCC.js → vue3-xml-viewer.common-C0bbtsGT.js} +2 -3
  42. package/package.json +2 -2
  43. package/src/components/CardMedia.vue +42 -0
  44. package/src/components/ChartCard.vue +53 -59
  45. package/src/components/DataserviceCard.vue +69 -85
  46. package/src/components/DataserviceQualityInline.vue +4 -20
  47. package/src/components/DataserviceQualityTooltipContent.vue +57 -65
  48. package/src/components/DatasetCard.vue +80 -93
  49. package/src/components/DatasetQualityInline.vue +4 -20
  50. package/src/components/DatasetQualityTooltipContent.vue +60 -62
  51. package/src/components/DiscussionMessageCard.vue +19 -22
  52. package/src/components/ObjectCard.vue +89 -18
  53. package/src/components/ObjectCardBadge.vue +27 -16
  54. package/src/components/ObjectCardMeta.vue +15 -0
  55. package/src/components/ObjectCardMetric.vue +23 -0
  56. package/src/components/ObjectCardMetrics.vue +6 -0
  57. package/src/components/ObjectCardOwner.vue +170 -17
  58. package/src/components/ObjectCardQuality.vue +32 -0
  59. package/src/components/ObjectCardShortDescription.vue +1 -1
  60. package/src/components/OrganizationCard.vue +101 -69
  61. package/src/components/OrganizationNameInline.vue +49 -0
  62. package/src/components/OrganizationTypeBadge.vue +21 -0
  63. package/src/components/OwnerType.vue +1 -1
  64. package/src/components/OwnerTypeIcon.vue +7 -3
  65. package/src/components/PostCard.vue +31 -35
  66. package/src/components/ProgressBar.vue +6 -3
  67. package/src/components/QualityItem.vue +9 -18
  68. package/src/components/QualityScore.vue +7 -1
  69. package/src/components/ReuseCard.vue +114 -95
  70. package/src/components/ReuseDetails.vue +19 -29
  71. package/src/components/SchemaCard.vue +30 -27
  72. package/src/components/Search/GlobalSearch.vue +7 -4
  73. package/src/components/Toggletip.vue +24 -12
  74. package/src/components/Tooltip.vue +113 -29
  75. package/src/components/TopicCard.vue +69 -78
  76. package/src/main.ts +0 -4
  77. package/dist/Tile-BV44yf69.js +0 -574
  78. package/dist/assets/maplibre-gl-worker-C24SsKwV.js +0 -10
  79. package/src/components/ObjectCardHeader.vue +0 -42
  80. package/src/components/OrganizationHorizontalCard.vue +0 -87
  81. package/src/components/ReuseHorizontalCard.vue +0 -81
@@ -1,22 +1,65 @@
1
1
  <template>
2
+ <!--
3
+ The title link covers the whole card through its `before` pseudo-element; interactive elements
4
+ inside the card (owner details, quality, tooltips) sit above it with `relative z-2`.
5
+ -->
2
6
  <article
3
- class="p-4 border bg-white border-gray-default relative hover:bg-gray-some fr-enlarge-link"
4
- :class="articleClass"
7
+ class="@container relative min-w-0 rounded border bg-white text-sm/[22px] text-gray-title
8
+ has-[[data-card-link]:hover]:bg-gray-some has-[[data-card-link]:active]:bg-gray-active
9
+ has-[[data-card-link]:focus-visible]:outline-2 has-[[data-card-link]:focus-visible]:outline-new-focus has-[[data-card-link]:focus-visible]:outline-offset-3"
10
+ :class="highlighted ? 'border-gray-secondary' : 'border-gray-default'"
5
11
  >
6
- <slot name="badge" />
7
- <div class="flex flex-wrap md:flex-nowrap gap-4 items-start">
12
+ <div
13
+ v-if="$slots.cover"
14
+ class="overflow-hidden rounded-t-[3px]"
15
+ >
16
+ <slot name="cover" />
17
+ </div>
18
+ <div
19
+ class="flex items-start p-4"
20
+ :class="layoutClass"
21
+ >
8
22
  <div
9
23
  v-if="$slots.media"
10
- class="flex-none"
24
+ class="flex-none max-w-full"
25
+ :class="mediaClass"
11
26
  >
12
27
  <div
13
- class="flex justify-center items-center border border-gray-lower bg-[#fff] rounded-md overflow-hidden"
14
- :class="mediaContainerClass"
28
+ class="flex justify-center items-center max-w-full overflow-hidden rounded border border-gray-default bg-white"
29
+ :class="frameClass"
15
30
  >
16
31
  <slot name="media" />
17
32
  </div>
18
33
  </div>
19
- <div class="flex-1 overflow-hidden space-y-1">
34
+ <div class="flex flex-col gap-1 flex-1 min-w-0 w-full">
35
+ <div class="flex items-start gap-x-2 gap-y-1 min-w-0 @max-[480px]:flex-col">
36
+ <component
37
+ :is="titleTag"
38
+ class="m-0 flex-1 min-w-0 w-full text-base/6 font-semibold text-gray-title [overflow-wrap:anywhere]"
39
+ >
40
+ <AppLink
41
+ :to="url"
42
+ :target
43
+ data-card-link
44
+ class="line-clamp-2 text-gray-title hover:text-new-primary bg-none no-underline focus-visible:outline-none
45
+ before:absolute before:inset-0 before:z-1 after:hidden"
46
+ >
47
+ <component
48
+ :is="icon"
49
+ v-if="icon"
50
+ class="size-4 inline-block align-[-2px] me-1"
51
+ aria-hidden="true"
52
+ />
53
+ <slot name="title" />
54
+ </AppLink>
55
+ </component>
56
+ <div
57
+ v-if="$slots.badge"
58
+ class="flex-none @max-[480px]:order-first"
59
+ >
60
+ <slot name="badge" />
61
+ </div>
62
+ </div>
20
63
  <slot />
21
64
  </div>
22
65
  </div>
@@ -24,22 +67,50 @@
24
67
  </template>
25
68
 
26
69
  <script setup lang="ts">
27
- import { computed } from 'vue'
70
+ import { computed, type Component } from 'vue'
71
+ import type { RouteLocationRaw } from 'vue-router'
72
+ import type { TitleTag } from '../types/ui'
73
+ import AppLink from './AppLink.vue'
28
74
 
29
75
  const props = withDefaults(defineProps<{
30
- articleClass?: string | string[] | Record<string, boolean>
76
+ url: RouteLocationRaw
77
+ target?: string
78
+ icon?: Component
79
+ titleTag?: TitleTag
80
+ // `sm` is a logo or an avatar, `lg` and `xl` an illustration.
31
81
  mediaSize?: 'sm' | 'lg' | 'xl'
82
+ // Puts the media above the content instead of beside it. Over a cover, the media overlaps it.
83
+ stacked?: boolean
84
+ highlighted?: boolean
32
85
  }>(), {
86
+ titleTag: 'h3',
33
87
  mediaSize: 'sm',
34
88
  })
35
89
 
36
- const mediaContainerClass = computed(() => {
37
- if (props.mediaSize === 'xl') {
38
- return 'w-[250px] h-[190px]'
39
- }
40
- if (props.mediaSize === 'lg') {
41
- return 'w-[225px] h-[120px]'
42
- }
43
- return 'p-2'
90
+ const slots = defineSlots<{
91
+ title(): unknown
92
+ badge?(): unknown
93
+ cover?(): unknown
94
+ media?(): unknown
95
+ default?(): unknown
96
+ }>()
97
+
98
+ // Beside the content, the media moves above it once the card is too narrow for both.
99
+ const layoutClass = computed(() => {
100
+ if (props.stacked) return 'flex-col gap-3'
101
+ if (props.mediaSize === 'sm') return 'gap-4 @max-[280px]:flex-col @max-[280px]:gap-3'
102
+ return 'gap-4 @max-[480px]:flex-col'
103
+ })
104
+
105
+ const mediaClass = computed(() => {
106
+ if (props.stacked && slots.cover) return 'relative -mt-10'
107
+ if (props.mediaSize === 'sm') return ''
108
+ return '@max-[480px]:w-full'
44
109
  })
110
+
111
+ const frameClass = computed(() => ({
112
+ sm: '',
113
+ lg: 'w-48 h-30 @max-[480px]:w-full @max-[480px]:h-auto @max-[480px]:aspect-video',
114
+ xl: 'w-56 h-40 @max-[480px]:w-full @max-[480px]:h-auto @max-[480px]:aspect-video',
115
+ })[props.mediaSize])
45
116
  </script>
@@ -1,22 +1,33 @@
1
1
  <template>
2
- <div class="absolute top-0 left-4 fr-grid-row fr-grid-row--middle fr-mt-n3v">
3
- <p class="fr-badge fr-badge--sm fr-badge--mention-grey text-gray-medium">
4
- <component
5
- :is="icon"
6
- aria-hidden="true"
7
- class="size-4 mr-1"
8
- />
9
- <slot />
10
- </p>
11
- </div>
2
+ <span
3
+ class="inline-flex items-center gap-1 max-w-full min-h-6 px-2 py-0.5 rounded border border-current/20 text-xs/[18px] font-medium"
4
+ :class="toneClass"
5
+ >
6
+ <component
7
+ :is="icon"
8
+ v-if="icon"
9
+ class="size-3.5 flex-none"
10
+ aria-hidden="true"
11
+ />
12
+ <span class="min-w-0 [overflow-wrap:anywhere]"><slot /></span>
13
+ </span>
12
14
  </template>
13
15
 
14
16
  <script setup lang="ts">
15
- // Only one ObjectCardBadge should be rendered at a time (use v-if/v-else-if),
16
- // because the absolute positioning will cause multiple badges to overlap.
17
- import type { Component } from 'vue'
17
+ import { computed, type Component } from 'vue'
18
18
 
19
- defineProps<{
20
- icon: Component
21
- }>()
19
+ const props = withDefaults(defineProps<{
20
+ icon?: Component | null
21
+ tone?: 'neutral' | 'info' | 'warning' | 'yellow' | 'danger'
22
+ }>(), {
23
+ tone: 'neutral',
24
+ })
25
+
26
+ const toneClass = computed(() => ({
27
+ neutral: 'bg-gray-lower text-gray-plain',
28
+ info: 'bg-blue-france-contrast text-new-primary',
29
+ warning: 'bg-new-warning-light text-new-warning',
30
+ yellow: 'bg-warning2-lightest text-warning2-dark',
31
+ danger: 'bg-new-error-light text-new-error',
32
+ })[props.tone])
22
33
  </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <!--
3
+ A separator is drawn before every item but the first. When the row wraps, the separator of the
4
+ item starting the new line falls outside the row and is clipped; the clip margin keeps the focus
5
+ rings of the items visible.
6
+ -->
7
+ <div
8
+ class="flex flex-wrap items-center gap-x-4 gap-y-1 max-w-full overflow-clip [overflow-clip-margin:6px] text-sm/6 text-gray-secondary
9
+ *:min-h-6 *:not-first:relative
10
+ *:not-first:before:absolute *:not-first:before:-start-[9px] *:not-first:before:top-0 *:not-first:before:h-6
11
+ *:not-first:before:border-s *:not-first:before:border-gray-default *:not-first:before:pointer-events-none"
12
+ >
13
+ <slot />
14
+ </div>
15
+ </template>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <span class="inline-flex items-center gap-0.5 text-xs/[18px] tabular-nums">
3
+ <component
4
+ :is="icon"
5
+ class="size-3.5 flex-none"
6
+ aria-hidden="true"
7
+ />
8
+ <span aria-hidden="true">{{ summarize(value) }}<template v-if="$slots.default">&nbsp;<slot /></template></span>
9
+ <span class="sr-only">{{ label }}</span>
10
+ </span>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import type { Component } from 'vue'
15
+ import { summarize } from '../functions/helpers'
16
+
17
+ defineProps<{
18
+ icon: Component
19
+ value: number
20
+ // Full sentence read by screen readers instead of the abbreviated value, e.g. "1 234 vues"
21
+ label: string
22
+ }>()
23
+ </script>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- A single item of `ObjectCardMeta`: the metrics are not separated from each other. -->
3
+ <span class="flex flex-wrap items-center gap-x-3 gap-y-2">
4
+ <slot />
5
+ </span>
6
+ </template>
@@ -1,53 +1,206 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="organization"
4
- class="-mr-0.5 flex-initial truncate"
4
+ class="flex items-center gap-2 min-w-0 max-w-full text-sm/6 text-gray-title [overflow-wrap:anywhere]"
5
5
  >
6
+ <OrganizationLogo
7
+ v-if="showLogo"
8
+ :organization="organization"
9
+ size-class="size-8 p-1 flex-none"
10
+ />
11
+ <Toggletip
12
+ v-if="showDetails && organizationUrl !== null"
13
+ :styled-button="false"
14
+ button-class="relative z-2 flex items-center max-w-full min-h-6 p-0 rounded border-0 bg-transparent text-left text-gray-title cursor-pointer
15
+ hover:bg-gray-some hover:underline underline-offset-3 aria-expanded:bg-gray-active aria-expanded:underline
16
+ focus-visible:outline-2 focus-visible:outline-new-focus focus-visible:outline-offset-3"
17
+ :button-props="{ title: t('À propos de cette organisation') }"
18
+ @opened="loadOrganization"
19
+ >
20
+ <OrganizationNameInline :organization />
21
+ <template #toggletip>
22
+ <section class="flex flex-col gap-4 text-sm/[22px] text-gray-title">
23
+ <div class="flex flex-col gap-3 min-w-0">
24
+ <header class="flex items-start gap-3">
25
+ <OrganizationLogo
26
+ :organization="summary"
27
+ size-class="size-12 p-1 flex-none rounded border border-gray-default overflow-hidden"
28
+ />
29
+ <h3 class="flex-1 m-0 text-base/6 font-semibold">
30
+ <OrganizationNameInline
31
+ :organization="summary"
32
+ :show-type="false"
33
+ />
34
+ </h3>
35
+ </header>
36
+ <OrganizationTypeBadge
37
+ :type="getOrganizationType(summary)"
38
+ class="self-start"
39
+ />
40
+ <p
41
+ v-if="'metrics' in summary"
42
+ class="flex flex-wrap gap-x-4 gap-y-2 m-0 text-gray-secondary"
43
+ >
44
+ <ObjectCardMetric
45
+ :icon="RiDatabase2Line"
46
+ :value="summary.metrics.datasets"
47
+ :label="t('{n} jeux de données | {n} jeu de données | {n} jeux de données', summary.metrics.datasets)"
48
+ >
49
+ {{ t('Jeux de données') }}
50
+ </ObjectCardMetric>
51
+ <ObjectCardMetric
52
+ :icon="RiTerminalLine"
53
+ :value="summary.metrics.dataservices"
54
+ :label="t('{n} API', summary.metrics.dataservices)"
55
+ >
56
+ {{ t('API') }}
57
+ </ObjectCardMetric>
58
+ <ObjectCardMetric
59
+ :icon="RiLineChartLine"
60
+ :value="summary.metrics.reuses"
61
+ :label="t('{n} réutilisations | {n} réutilisation | {n} réutilisations', summary.metrics.reuses)"
62
+ >
63
+ {{ t('Réutilisations') }}
64
+ </ObjectCardMetric>
65
+ </p>
66
+ <ObjectCardShortDescription
67
+ v-if="'description' in summary"
68
+ :text="summary.description"
69
+ />
70
+ <!-- Same line boxes as the metrics and the two-line description it stands for -->
71
+ <div
72
+ v-if="loading"
73
+ role="status"
74
+ class="flex flex-col gap-3"
75
+ >
76
+ <span class="sr-only">{{ t('Chargement…') }}</span>
77
+ <span
78
+ class="h-[18px] w-4/5 rounded bg-gray-some animate-pulse-placeholder"
79
+ aria-hidden="true"
80
+ />
81
+ <span
82
+ class="flex flex-col"
83
+ aria-hidden="true"
84
+ >
85
+ <span
86
+ v-for="width in ['w-full', 'w-3/5']"
87
+ :key="width"
88
+ class="flex items-center h-[22px]"
89
+ >
90
+ <span
91
+ class="h-3.5 rounded bg-gray-some animate-pulse-placeholder"
92
+ :class="width"
93
+ />
94
+ </span>
95
+ </span>
96
+ </div>
97
+ </div>
98
+ <p
99
+ v-if="loadFailed"
100
+ role="status"
101
+ class="m-0"
102
+ >
103
+ {{ t('Les détails de cette organisation sont temporairement indisponibles.') }}
104
+ </p>
105
+ <AppLink
106
+ :to="organizationUrl || organization.page"
107
+ class="block pt-3 border-t border-gray-default font-medium text-gray-title bg-none underline underline-offset-3"
108
+ >
109
+ {{ t('Voir la page de l’organisation') }}
110
+ </AppLink>
111
+ </section>
112
+ </template>
113
+ </Toggletip>
6
114
  <AppLink
7
- v-if="organizationUrl !== null"
8
- class="link text-sm overflow-hidden flex items-center relative z-[2] truncate"
115
+ v-else-if="organizationUrl !== null"
116
+ class="relative z-2 flex items-center min-w-0 text-gray-title bg-none underline underline-offset-3"
9
117
  :to="organizationUrl || organization.page"
10
118
  >
11
- <OrganizationNameWithCertificate
12
- :organization
13
- size="sm"
14
- />
119
+ <OrganizationNameInline :organization />
15
120
  </AppLink>
16
121
  <span
17
122
  v-else
18
- class="text-sm overflow-hidden flex items-center truncate"
123
+ class="relative z-2 flex items-center min-w-0 cursor-text"
19
124
  >
20
- <OrganizationNameWithCertificate
21
- :organization
22
- size="sm"
23
- color-class="text-gray-title"
24
- />
125
+ <OrganizationNameInline :organization />
25
126
  </span>
26
127
  </div>
27
128
  <div
28
129
  v-else-if="ownerName"
29
- class="mr-1 truncate"
130
+ class="min-w-0 text-sm/6 text-gray-title [overflow-wrap:anywhere]"
30
131
  >
31
132
  {{ ownerName }}
32
133
  </div>
33
134
  </template>
34
135
 
35
136
  <script setup lang="ts">
36
- import { computed } from 'vue'
137
+ import { computed, ref, watch, onBeforeUnmount } from 'vue'
37
138
  import type { RouteLocationRaw } from 'vue-router'
139
+ import { RiDatabase2Line, RiLineChartLine, RiTerminalLine } from '@remixicon/vue'
140
+ import { useTranslation } from '../composables/useTranslation'
141
+ import { useComponentsConfig } from '../config'
38
142
  import { getOwnerName } from '../functions/owned'
39
- import type { OrganizationReference } from '../types/organizations'
143
+ import { getOrganizationType } from '../functions/organizations'
144
+ import type { Organization, OrganizationReference } from '../types/organizations'
40
145
  import type { UserReference } from '../types/users'
41
146
  import AppLink from './AppLink.vue'
42
- import OrganizationNameWithCertificate from './OrganizationNameWithCertificate.vue'
147
+ import ObjectCardMetric from './ObjectCardMetric.vue'
148
+ import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
149
+ import OrganizationLogo from './OrganizationLogo.vue'
150
+ import OrganizationNameInline from './OrganizationNameInline.vue'
151
+ import OrganizationTypeBadge from './OrganizationTypeBadge.vue'
152
+ import Toggletip from './Toggletip.vue'
43
153
 
44
154
  const props = defineProps<{
155
+ showDetails?: boolean
156
+ showLogo?: boolean
45
157
  organization?: OrganizationReference | null
46
158
  owner?: UserReference | null
47
159
  // undefined falls back to organization.page; pass null to render plain, non-linked text
48
160
  organizationUrl?: RouteLocationRaw | null
49
161
  }>()
50
162
 
163
+ const { t } = useTranslation()
164
+ const config = useComponentsConfig()
165
+
166
+ // The card only receives a reference (name, logo, badges): the description and the metrics
167
+ // shown in the details are fetched when they are first opened.
168
+ const fullOrganization = ref<Organization | null>(null)
169
+ const summary = computed(() => fullOrganization.value ?? props.organization!)
170
+ const loading = ref(false)
171
+ const loadFailed = ref(false)
172
+ let controller: AbortController | undefined
173
+ watch(() => props.organization?.id, () => {
174
+ controller?.abort()
175
+ fullOrganization.value = null
176
+ loading.value = false
177
+ loadFailed.value = false
178
+ })
179
+ onBeforeUnmount(() => controller?.abort())
180
+
181
+ async function loadOrganization() {
182
+ if (!props.organization || fullOrganization.value || loading.value) return
183
+ // Embedded full organizations (including gallery examples) need no extra request.
184
+ if ('metrics' in props.organization && 'description' in props.organization) return
185
+ const request = new AbortController()
186
+ controller = request
187
+ loading.value = true
188
+ loadFailed.value = false
189
+ try {
190
+ const result = await config.$fetch<Organization>(`/api/1/organizations/${encodeURIComponent(props.organization.id)}/`, {
191
+ baseURL: config.apiBase,
192
+ signal: request.signal,
193
+ })
194
+ if (!request.signal.aborted) fullOrganization.value = result
195
+ }
196
+ catch {
197
+ if (!request.signal.aborted) loadFailed.value = true
198
+ }
199
+ finally {
200
+ if (!request.signal.aborted) loading.value = false
201
+ }
202
+ }
203
+
51
204
  const ownerName = computed(() => {
52
205
  if (!props.owner) return ''
53
206
  return getOwnerName({ organization: null, owner: props.owner })
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="min-w-0 max-w-full">
3
+ <Toggletip
4
+ :styled-button="false"
5
+ button-class="group relative z-2 flex flex-wrap items-center gap-2 min-h-6 p-0 rounded border-0 text-left cursor-pointer text-sm/6 text-gray-secondary
6
+ hover:bg-gray-some focus-visible:outline-2 focus-visible:outline-new-focus focus-visible:outline-offset-3"
7
+ :button-props="{ title: t('Qualité des métadonnées') }"
8
+ >
9
+ <span class="group-hover:underline underline-offset-3">{{ t('Métadonnées') }}</span>
10
+ <QualityScore
11
+ :score
12
+ compact
13
+ class="translate-y-px"
14
+ />
15
+ <template #toggletip>
16
+ <slot />
17
+ </template>
18
+ </Toggletip>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import { useTranslation } from '../composables/useTranslation'
24
+ import QualityScore from './QualityScore.vue'
25
+ import Toggletip from './Toggletip.vue'
26
+
27
+ defineProps<{
28
+ score: number
29
+ }>()
30
+
31
+ const { t } = useTranslation()
32
+ </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <p
3
3
  v-if="shortDescription"
4
- class="fr-text--sm fr-mt-1w fr-mb-0 overflow-wrap-anywhere hidden sm:line-clamp-2"
4
+ class="m-0 line-clamp-2 [overflow-wrap:anywhere] text-sm/[22px] text-gray-secondary"
5
5
  >
6
6
  {{ shortDescription }}
7
7
  </p>