@datagouv/components-next 1.4.1-dev.1372.g3970bd3c → 1.4.1-dev.1374.g4dfe0257

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 (54) hide show
  1. package/assets/main.css +4 -0
  2. package/dist/{Datafair.client-Ci2WOgAS.js → Datafair.client-LChXlMI3.js} +1 -1
  3. package/dist/{ImagePreview.client-B4RtxuiJ.js → ImagePreview.client-DWNGZghK.js} +1 -1
  4. package/dist/{JsonPreview.client-r7swv2fp.js → JsonPreview.client-DCklbUyJ.js} +2 -2
  5. package/dist/{MapContainer.client-CxH1a8Tn.js → MapContainer.client-B-aQhH35.js} +6 -6
  6. package/dist/{PdfPreview.client-BjeMcqcy.js → PdfPreview.client-1WFiBcXh.js} +3 -3
  7. package/dist/{PdfSkeleton-CVZxJaeL.js → PdfSkeleton-BvU7ERD1.js} +1 -1
  8. package/dist/{Pmtiles.client-D8idR2l7.js → Pmtiles.client-BlbOlwyy.js} +2 -2
  9. package/dist/{PreviewError-Cx7CItT_.js → PreviewError-BfBCBDEx.js} +6873 -6871
  10. package/dist/{PreviewWrapper-Cd1RSmS-.js → PreviewWrapper-DvycGC7l.js} +1 -1
  11. package/dist/{XmlPreview.client-cSebx8br.js → XmlPreview.client-ClFD8R3a.js} +2 -2
  12. package/dist/components-next.css +1 -1
  13. package/dist/components-next.js +11925 -11678
  14. package/dist/components.css +1 -1
  15. package/dist/{france-DPcdJc84.js → france-JfC0dOuE.js} +1 -1
  16. package/package.json +1 -1
  17. package/src/components/CardMedia.vue +42 -0
  18. package/src/components/ChartCard.vue +53 -59
  19. package/src/components/DataserviceCard.vue +69 -85
  20. package/src/components/DataserviceQualityInline.vue +4 -20
  21. package/src/components/DataserviceQualityTooltipContent.vue +57 -65
  22. package/src/components/DatasetCard.vue +80 -93
  23. package/src/components/DatasetQualityInline.vue +4 -20
  24. package/src/components/DatasetQualityTooltipContent.vue +60 -62
  25. package/src/components/DiscussionMessageCard.vue +19 -22
  26. package/src/components/Form/SearchableSelect.vue +4 -0
  27. package/src/components/ObjectCard.vue +89 -18
  28. package/src/components/ObjectCardBadge.vue +27 -16
  29. package/src/components/ObjectCardMeta.vue +15 -0
  30. package/src/components/ObjectCardMetric.vue +23 -0
  31. package/src/components/ObjectCardMetrics.vue +6 -0
  32. package/src/components/ObjectCardOwner.vue +170 -17
  33. package/src/components/ObjectCardQuality.vue +32 -0
  34. package/src/components/ObjectCardShortDescription.vue +1 -1
  35. package/src/components/OrganizationCard.vue +101 -69
  36. package/src/components/OrganizationNameInline.vue +49 -0
  37. package/src/components/OrganizationTypeBadge.vue +21 -0
  38. package/src/components/OwnerType.vue +1 -1
  39. package/src/components/OwnerTypeIcon.vue +7 -3
  40. package/src/components/PostCard.vue +31 -35
  41. package/src/components/ProgressBar.vue +6 -3
  42. package/src/components/QualityItem.vue +9 -18
  43. package/src/components/QualityScore.vue +7 -1
  44. package/src/components/ReuseCard.vue +114 -95
  45. package/src/components/ReuseDetails.vue +19 -29
  46. package/src/components/SchemaCard.vue +30 -27
  47. package/src/components/Search/GlobalSearch.vue +7 -4
  48. package/src/components/Toggletip.vue +24 -12
  49. package/src/components/Tooltip.vue +113 -29
  50. package/src/components/TopicCard.vue +69 -78
  51. package/src/main.ts +0 -4
  52. package/src/components/ObjectCardHeader.vue +0 -42
  53. package/src/components/OrganizationHorizontalCard.vue +0 -87
  54. package/src/components/ReuseHorizontalCard.vue +0 -81
@@ -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>
@@ -1,90 +1,122 @@
1
1
  <template>
2
- <div class="border border-gray-default bg-white relative fr-enlarge-link">
3
- <div class="h-[4.5rem] pt-4 px-4 bg-blue-lighter" />
4
- <div class="px-4 pb-4 pt-5 mt-2">
5
- <div class="inline-flex border border-gray-default p-1.5 absolute top-4 left-4 bg-white">
2
+ <ObjectCard
3
+ :url="organization.page"
4
+ :stacked="!horizontal"
5
+ >
6
+ <template
7
+ v-if="!horizontal"
8
+ #cover
9
+ >
10
+ <div
11
+ data-testid="organization-banner"
12
+ class="h-16"
13
+ :class="{ 'bg-gray-some': !bannerColor }"
14
+ :style="bannerColor ? { backgroundColor: bannerColor } : undefined"
15
+ aria-hidden="true"
16
+ >
6
17
  <img
7
- :src="organization.logo_thumbnail"
8
- width="64"
9
- height="64"
18
+ v-if="bannerImage && !bannerFailed"
19
+ :src="bannerImage"
10
20
  alt=""
11
21
  loading="lazy"
22
+ class="size-full object-cover"
23
+ :style="{ objectPosition: `center ${bannerPosition}%` }"
24
+ @error="bannerFailed = true"
12
25
  >
13
26
  </div>
14
- <div class="mb-0.5 font-bold">
15
- <AppLink
16
- :to="organization.page"
17
- class="overflow-hidden"
18
- >
19
- <OrganizationNameWithCertificate
20
- :show-type="false"
21
- :organization
22
- />
23
- </AppLink>
24
- </div>
25
- <div class="mb-2 flex flex-wrap gap-1 items-center">
26
- <template v-if="type !== 'other'">
27
- <OwnerType
28
- class="mb-0 text-sm"
29
- :type
30
- />
31
- <RiSubtractLine
32
- aria-hidden="true"
33
- class="size-4 fill-gray-medium"
34
- />
35
- </template>
36
- <div>
37
- <div
38
- v-if="'metrics' in organization"
39
- class="text-gray-medium flex items-center text-sm gap-0.5"
40
- :aria-label="t('{datasets} jeux de données, {dataservices} API et {reuses} réutilisations', {
41
- datasets: organization.metrics.datasets,
42
- dataservices: organization.metrics.dataservices,
43
- reuses: organization.metrics.reuses,
44
- })"
45
- >
46
- <RiDatabase2Line
47
- aria-hidden="true"
48
- class="size-4 -mt-1"
49
- /> {{ organization.metrics.datasets }}
50
- <RiTerminalLine
51
- aria-hidden="true"
52
- class="size-4 -mt-1 ml-1"
53
- /> {{ organization.metrics.dataservices }}
54
- <RiLineChartLine
55
- aria-hidden="true"
56
- class="size-4 -mt-1 ml-1"
57
- /> {{ organization.metrics.reuses }}
58
- </div>
59
- </div>
60
- </div>
61
- <div class="mt-1 mb-0">
62
- <TextClamp
63
- v-if="'description' in organization"
64
- :text="removeMarkdownSync(organization.description)"
65
- :max-lines="3"
27
+ </template>
28
+ <template #media>
29
+ <OrganizationLogo
30
+ :organization
31
+ size-class="size-12 p-1"
32
+ />
33
+ </template>
34
+ <template #title>
35
+ <OrganizationNameInline
36
+ :organization
37
+ :show-type="false"
38
+ />
39
+ </template>
40
+ <template
41
+ v-if="type !== OTHER"
42
+ #badge
43
+ >
44
+ <OrganizationTypeBadge
45
+ :type
46
+ class="max-[480px]:hidden"
47
+ />
48
+ </template>
49
+
50
+ <ObjectCardMeta
51
+ v-if="'metrics' in organization"
52
+ class="mt-1 max-[480px]:hidden"
53
+ >
54
+ <ObjectCardMetrics>
55
+ <ObjectCardMetric
56
+ :icon="RiDatabase2Line"
57
+ :value="organization.metrics.datasets"
58
+ :label="t('{n} jeux de données | {n} jeu de données | {n} jeux de données', organization.metrics.datasets)"
66
59
  />
67
- </div>
68
- </div>
69
- </div>
60
+ <ObjectCardMetric
61
+ :icon="RiTerminalLine"
62
+ :value="organization.metrics.dataservices"
63
+ :label="t('{n} API', organization.metrics.dataservices)"
64
+ />
65
+ <ObjectCardMetric
66
+ :icon="RiLineChartLine"
67
+ :value="organization.metrics.reuses"
68
+ :label="t('{n} réutilisations | {n} réutilisation | {n} réutilisations', organization.metrics.reuses)"
69
+ />
70
+ <ObjectCardMetric
71
+ :icon="RiStarLine"
72
+ :value="organization.metrics.followers"
73
+ :label="t('{n} abonnés | {n} abonné | {n} abonnés', organization.metrics.followers)"
74
+ />
75
+ </ObjectCardMetrics>
76
+ </ObjectCardMeta>
77
+ <ObjectCardShortDescription
78
+ v-if="'description' in organization"
79
+ :text="organization.description"
80
+ class="mt-1 max-md:hidden"
81
+ />
82
+ </ObjectCard>
70
83
  </template>
71
84
 
72
85
  <script setup lang="ts">
73
- import { RiLineChartLine, RiDatabase2Line, RiTerminalLine, RiSubtractLine } from '@remixicon/vue'
74
- import { computed } from 'vue'
75
- import { removeMarkdownSync } from '../functions/markdown'
76
- import { getOrganizationType } from '../functions/organizations'
86
+ import { computed, ref, watch } from 'vue'
87
+ import { RiDatabase2Line, RiLineChartLine, RiStarLine, RiTerminalLine } from '@remixicon/vue'
88
+ import { getOrganizationType, OTHER } from '../functions/organizations'
77
89
  import type { Organization, OrganizationReference } from '../types/organizations'
78
- import OwnerType from './OwnerType.vue'
79
- import OrganizationNameWithCertificate from './OrganizationNameWithCertificate.vue'
80
- import AppLink from './AppLink.vue'
81
90
  import { useTranslation } from '../composables/useTranslation'
91
+ import ObjectCard from './ObjectCard.vue'
92
+ import ObjectCardMeta from './ObjectCardMeta.vue'
93
+ import ObjectCardMetric from './ObjectCardMetric.vue'
94
+ import ObjectCardMetrics from './ObjectCardMetrics.vue'
95
+ import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
96
+ import OrganizationLogo from './OrganizationLogo.vue'
97
+ import OrganizationNameInline from './OrganizationNameInline.vue'
98
+ import OrganizationTypeBadge from './OrganizationTypeBadge.vue'
82
99
 
83
100
  const props = defineProps<{
84
101
  organization: Organization | OrganizationReference
102
+ /**
103
+ * Puts the logo beside the content, without the banner, for full-width lists.
104
+ * The card falls back to the vertical layout when it gets too narrow.
105
+ */
106
+ horizontal?: boolean
85
107
  }>()
86
108
 
87
109
  const { t } = useTranslation()
88
110
 
89
111
  const type = computed(() => getOrganizationType(props.organization))
112
+
113
+ const bannerColor = computed(() => 'banner_color' in props.organization ? props.organization.banner_color : null)
114
+ const bannerImage = computed(() => 'banner_image' in props.organization ? props.organization.banner_image : null)
115
+ const bannerPosition = computed(() => 'banner_image_position' in props.organization ? (props.organization.banner_image_position ?? 50) : 50)
116
+
117
+ // A broken banner falls back to the plain color instead of the browser's broken image icon.
118
+ const bannerFailed = ref(false)
119
+ watch(bannerImage, () => {
120
+ bannerFailed.value = false
121
+ })
90
122
  </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <span class="min-w-0 [overflow-wrap:anywhere]">
3
+ <OwnerTypeIcon
4
+ v-if="showType"
5
+ :type="getOrganizationType(organization)"
6
+ size-class="size-4 inline-block align-[-2px] me-1"
7
+ />{{ organization.name }}<span
8
+ v-if="isOrganizationCertified(organization)"
9
+ class="relative z-2 ms-1 inline-flex align-[-2px]"
10
+ >
11
+ <Tooltip as="span">
12
+ <RiCheckboxCircleLine
13
+ class="size-4 block"
14
+ aria-hidden="true"
15
+ />
16
+ <span class="sr-only">{{ certifiedLabel }}</span>
17
+ <template #tooltip>
18
+ <p class="text-sm font-normal mb-0">
19
+ {{ certifiedLabel }}
20
+ </p>
21
+ </template>
22
+ </Tooltip>
23
+ </span>
24
+ </span>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { computed } from 'vue'
29
+ import { RiCheckboxCircleLine } from '@remixicon/vue'
30
+ import { getOrganizationType, isOrganizationCertified } from '../functions/organizations'
31
+ import type { Organization, OrganizationReference } from '../types/organizations'
32
+ import { useComponentsConfig } from '../config'
33
+ import { useTranslation } from '../composables/useTranslation'
34
+ import OwnerTypeIcon from './OwnerTypeIcon.vue'
35
+ import Tooltip from './Tooltip.vue'
36
+
37
+ // Organization name flowing in a text: it wraps over several lines, the certificate follows
38
+ // its last word, and it inherits the font and the color of its container.
39
+ withDefaults(defineProps<{
40
+ organization: Organization | OrganizationReference
41
+ showType?: boolean
42
+ }>(), {
43
+ showType: true,
44
+ })
45
+
46
+ const config = useComponentsConfig()
47
+ const { t } = useTranslation()
48
+ const certifiedLabel = computed(() => t(`L'identité de ce service public est certifiée par {certifier}`, { certifier: config.name }))
49
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <ObjectCardBadge
3
+ v-if="organizationType.type !== OTHER"
4
+ :icon="organizationType.icon"
5
+ :tone="type === PUBLIC_SERVICE || type === LOCAL_AUTHORITY ? 'info' : 'neutral'"
6
+ >
7
+ {{ organizationType.label }}
8
+ </ObjectCardBadge>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { computed } from 'vue'
13
+ import { findOrganizationType, LOCAL_AUTHORITY, OTHER, PUBLIC_SERVICE, type OrganizationTypes } from '../functions/organizations'
14
+ import ObjectCardBadge from './ObjectCardBadge.vue'
15
+
16
+ const props = defineProps<{
17
+ type: OrganizationTypes
18
+ }>()
19
+
20
+ const organizationType = computed(() => findOrganizationType(props.type))
21
+ </script>
@@ -2,7 +2,7 @@
2
2
  <div :class="`${colorClass} flex items-center gap-1`">
3
3
  <OwnerTypeIcon
4
4
  :type="type"
5
- class="size-4"
5
+ size-class="size-4"
6
6
  />
7
7
  <div :class="sizeClass">
8
8
  {{ name }}
@@ -2,7 +2,8 @@
2
2
  <component
3
3
  :is="icon"
4
4
  v-if="icon"
5
- class="size-3.5 flex-none"
5
+ class="flex-none"
6
+ :class="sizeClass"
6
7
  aria-hidden="true"
7
8
  />
8
9
  </template>
@@ -11,9 +12,12 @@
11
12
  import { computed } from 'vue'
12
13
  import { findOrganizationType, type OrganizationTypes, type UserType } from '../functions/organizations'
13
14
 
14
- const props = defineProps<{
15
+ const props = withDefaults(defineProps<{
15
16
  type: OrganizationTypes | UserType
16
- }>()
17
+ sizeClass?: string
18
+ }>(), {
19
+ sizeClass: 'size-3.5',
20
+ })
17
21
 
18
22
  const icon = computed(() => findOrganizationType(props.type).icon)
19
23
  </script>