@datagouv/components-next 1.4.1-dev.1373.g379aceb6 → 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 (53) 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 +11924 -11677
  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/ObjectCard.vue +89 -18
  27. package/src/components/ObjectCardBadge.vue +27 -16
  28. package/src/components/ObjectCardMeta.vue +15 -0
  29. package/src/components/ObjectCardMetric.vue +23 -0
  30. package/src/components/ObjectCardMetrics.vue +6 -0
  31. package/src/components/ObjectCardOwner.vue +170 -17
  32. package/src/components/ObjectCardQuality.vue +32 -0
  33. package/src/components/ObjectCardShortDescription.vue +1 -1
  34. package/src/components/OrganizationCard.vue +101 -69
  35. package/src/components/OrganizationNameInline.vue +49 -0
  36. package/src/components/OrganizationTypeBadge.vue +21 -0
  37. package/src/components/OwnerType.vue +1 -1
  38. package/src/components/OwnerTypeIcon.vue +7 -3
  39. package/src/components/PostCard.vue +31 -35
  40. package/src/components/ProgressBar.vue +6 -3
  41. package/src/components/QualityItem.vue +9 -18
  42. package/src/components/QualityScore.vue +7 -1
  43. package/src/components/ReuseCard.vue +114 -95
  44. package/src/components/ReuseDetails.vue +19 -29
  45. package/src/components/SchemaCard.vue +30 -27
  46. package/src/components/Search/GlobalSearch.vue +7 -4
  47. package/src/components/Toggletip.vue +24 -12
  48. package/src/components/Tooltip.vue +113 -29
  49. package/src/components/TopicCard.vue +69 -78
  50. package/src/main.ts +0 -4
  51. package/src/components/ObjectCardHeader.vue +0 -42
  52. package/src/components/OrganizationHorizontalCard.vue +0 -87
  53. package/src/components/ReuseHorizontalCard.vue +0 -81
@@ -1,57 +1,141 @@
1
1
  <template>
2
- <div
2
+ <component
3
+ :is="as"
3
4
  class="relative"
4
- @focusin="show = true"
5
- @mouseenter="show = true"
5
+ @focusin="open"
6
+ @mouseenter="open"
6
7
  @focusout="show = false"
7
- @mouseleave="show = false"
8
+ @mouseleave="closeSoon"
9
+ @keydown.esc="dismiss"
8
10
  >
9
11
  <span
10
12
  ref="reference"
11
13
  v-bind="$attrs"
12
- :aria-describedby="id"
14
+ :tabindex="needsFocus ? 0 : undefined"
13
15
  >
14
16
  <slot />
15
17
  </span>
16
18
 
17
- <div
19
+ <Teleport
18
20
  v-if="show"
19
- :id
20
- ref="floating"
21
- role="tooltip"
22
- aria-hidden="true"
23
- class="z-10 pt-2"
24
- :class="tooltipClass"
25
- :style="loaded ? floatingStyles : ''"
21
+ to="#tooltips"
26
22
  >
27
- <div class="drop-shadow bg-white p-2 whitespace-nowrap">
28
- <slot name="tooltip" />
23
+ <div
24
+ :id
25
+ ref="floating"
26
+ role="tooltip"
27
+ class="z-[900] pt-2"
28
+ :class="tooltipClass"
29
+ :style="floatingStyles"
30
+ @mouseenter="open"
31
+ @mouseleave="closeSoon"
32
+ >
33
+ <div class="w-max max-w-[min(22rem,calc(100vw-2rem))] p-3 rounded border border-gray-default bg-white shadow-overlay text-sm/[22px] text-gray-title [overflow-wrap:anywhere]">
34
+ <slot name="tooltip" />
35
+ </div>
29
36
  </div>
30
- </div>
31
- </div>
37
+ </Teleport>
38
+ </component>
32
39
  </template>
33
40
 
34
41
  <script setup lang="ts">
35
- import { useFloating, autoUpdate, autoPlacement } from '@floating-ui/vue'
36
- import { onMounted, ref, useId, useTemplateRef } from 'vue'
42
+ import { useFloating, autoUpdate, autoPlacement, shift } from '@floating-ui/vue'
43
+ import { useEventListener } from '@vueuse/core'
44
+ import { onBeforeUnmount, onMounted, ref, useId, useTemplateRef, watchEffect } from 'vue'
37
45
 
38
- defineProps<{
46
+ withDefaults(defineProps<{
39
47
  tooltipClass?: string
40
- }>()
48
+ as?: string
49
+ }>(), {
50
+ as: 'div',
51
+ })
41
52
 
42
53
  const id = useId()
43
54
  const show = ref(false)
44
- const loaded = ref(false)
45
55
 
46
- const referenceRef = useTemplateRef('reference')
47
- const floatingRef = useTemplateRef('floating')
56
+ const referenceRef = useTemplateRef<HTMLElement>('reference')
57
+ const floatingRef = useTemplateRef<HTMLElement>('floating')
48
58
  const { floatingStyles } = useFloating(referenceRef, floatingRef, {
49
- middleware: [autoPlacement({
50
- allowedPlacements: ['bottom-start', 'bottom', 'bottom-end'],
51
- crossAxis: true,
52
- })],
59
+ strategy: 'fixed',
60
+ middleware: [
61
+ autoPlacement({
62
+ allowedPlacements: ['bottom-start', 'bottom', 'bottom-end'],
63
+ crossAxis: true,
64
+ }),
65
+ shift({ padding: 16 }),
66
+ ],
53
67
  whileElementsMounted: autoUpdate,
54
68
  })
55
69
 
56
- onMounted(() => loaded.value = true)
70
+ // Inside a link or a button, the focus lands on that element, never on the tooltip itself:
71
+ // the tooltip follows its keyboard focus instead.
72
+ const focusableParent = ref<HTMLElement | null>(null)
73
+ // Around a plain icon or text, nothing could take the focus: the tooltip would stay out of
74
+ // reach of the keyboard, so its content becomes focusable itself.
75
+ const needsFocus = ref(false)
76
+ let focusedWithPointer = false
77
+
78
+ function onParentFocus(event: FocusEvent) {
79
+ show.value = !focusedWithPointer && (event.currentTarget as HTMLElement).matches(':focus-visible')
80
+ }
81
+ function onParentPointerDown() {
82
+ focusedWithPointer = true
83
+ show.value = false
84
+ }
85
+ function onParentBlur() {
86
+ focusedWithPointer = false
87
+ show.value = false
88
+ }
89
+ function onParentKeydown(event: KeyboardEvent) {
90
+ focusedWithPointer = false
91
+ // Activating the parent opens what it controls, which the tooltip would cover.
92
+ if (event.key === 'Enter' || event.key === ' ') show.value = false
93
+ if (event.key === 'Escape') dismiss(event)
94
+ }
95
+
96
+ useEventListener(focusableParent, 'focus', onParentFocus)
97
+ useEventListener(focusableParent, 'pointerdown', onParentPointerDown)
98
+ useEventListener(focusableParent, 'blur', onParentBlur)
99
+ useEventListener(focusableParent, 'keydown', onParentKeydown)
100
+
101
+ onMounted(() => {
102
+ const parent = referenceRef.value?.parentElement?.closest<HTMLElement>('a, button') ?? null
103
+ focusableParent.value = parent
104
+ needsFocus.value = !parent && !referenceRef.value?.querySelector('a, button, input, select, textarea, [tabindex]')
105
+ })
106
+
107
+ // The tooltip is teleported out of the reference: moving the pointer from one to the other
108
+ // leaves the reference first, so closing waits for the pointer to reach the tooltip, whose
109
+ // content (a link for instance) must stay usable.
110
+ let closeTimeout: ReturnType<typeof setTimeout> | undefined
111
+ function open() {
112
+ clearTimeout(closeTimeout)
113
+ show.value = true
114
+ }
115
+ function closeSoon() {
116
+ clearTimeout(closeTimeout)
117
+ closeTimeout = setTimeout(() => show.value = false, 100)
118
+ }
119
+ onBeforeUnmount(() => clearTimeout(closeTimeout))
120
+
121
+ // Describe the element that holds the focus, and only while the tooltip is rendered:
122
+ // a reference to a missing id is ignored by screen readers.
123
+ watchEffect((onCleanup) => {
124
+ const described = focusableParent.value ?? referenceRef.value
125
+ if (!described || !show.value) return
126
+ const ids = new Set(described.getAttribute('aria-describedby')?.split(/\s+/).filter(Boolean))
127
+ ids.add(id)
128
+ described.setAttribute('aria-describedby', [...ids].join(' '))
129
+ onCleanup(() => {
130
+ const remaining = described.getAttribute('aria-describedby')?.split(/\s+/).filter(value => value !== id).join(' ')
131
+ if (remaining) described.setAttribute('aria-describedby', remaining)
132
+ else described.removeAttribute('aria-describedby')
133
+ })
134
+ })
135
+
136
+ function dismiss(event: KeyboardEvent) {
137
+ if (!show.value) return
138
+ event.stopPropagation()
139
+ show.value = false
140
+ }
57
141
  </script>
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <ObjectCard>
2
+ <ObjectCard
3
+ :url="topicUrl || topic.page || '#'"
4
+ :icon="RiBookShelfLine"
5
+ >
3
6
  <template
4
7
  v-if="showLogo"
5
8
  #media
@@ -7,7 +10,7 @@
7
10
  <OrganizationLogo
8
11
  v-if="topic.organization"
9
12
  :organization="topic.organization"
10
- size-class="size-12"
13
+ size-class="size-12 p-1"
11
14
  />
12
15
  <Avatar
13
16
  v-else-if="topic.owner"
@@ -20,100 +23,82 @@
20
23
  class="size-12"
21
24
  />
22
25
  </template>
23
-
24
- <ObjectCardHeader
25
- :icon="RiBookShelfLine"
26
- :url="topicUrl || topic.page || '#'"
27
- >
26
+ <template #title>
28
27
  {{ topic.name }}
29
- </ObjectCardHeader>
28
+ </template>
30
29
 
31
- <div
30
+ <ObjectCardOwner
32
31
  v-if="topic.organization || topic.owner"
33
- class="text-sm flex flex-wrap md:flex-nowrap gap-y-1 items-center truncate"
34
- >
35
- <ObjectCardOwner
36
- :organization="topic.organization"
37
- :owner="topic.owner"
38
- :organization-url="organizationUrl"
39
- />
40
- <RiSubtractLine
41
- v-if="(topic.organization || topic.owner) && topic.last_modified"
42
- aria-hidden="true"
43
- class="hidden md:block size-4 flex-none fill-gray-medium"
44
- />
32
+ :show-logo="!showLogo"
33
+ show-details
34
+ :organization="topic.organization"
35
+ :owner="topic.owner"
36
+ :organization-url="organizationUrl"
37
+ />
38
+ <ObjectCardMeta v-if="topic.last_modified">
45
39
  <TranslationT
46
- v-if="topic.last_modified"
47
- tag="div"
48
- class="w-full md:w-auto text-gray-medium whitespace-nowrap"
40
+ tag="span"
41
+ class="tabular-nums"
49
42
  keypath="Mis à jour {date}"
50
43
  >
51
44
  <template #date>
52
45
  <FormattedDate
53
46
  :date="topic.last_modified"
54
47
  format="relative"
55
- :options="{ dateStyle: 'long' }"
48
+ :options="{ dateStyle: 'medium' }"
56
49
  />
57
50
  </template>
58
51
  </TranslationT>
59
- </div>
60
-
61
- <ObjectCardShortDescription :text="topic.description" />
62
-
63
- <div
64
- v-if="showStats && (topic.nb_datasets || topic.nb_dataservices || topic.nb_reuses)"
65
- class="flex items-center gap-4 mt-2 text-xs text-gray-medium"
52
+ </ObjectCardMeta>
53
+ <ObjectCardMeta
54
+ v-if="showStats && hasStats"
55
+ class="max-[480px]:hidden"
66
56
  >
67
- <div
68
- v-if="topic.nb_datasets"
69
- class="flex items-center gap-1"
70
- >
71
- <RiDatabase2Line
72
- aria-hidden="true"
73
- class="size-4"
57
+ <ObjectCardMetrics>
58
+ <ObjectCardMetric
59
+ v-if="topic.nb_datasets !== undefined"
60
+ :icon="RiDatabase2Line"
61
+ :value="topic.nb_datasets"
62
+ :label="t('{n} jeux de données | {n} jeu de données | {n} jeux de données', topic.nb_datasets)"
74
63
  />
75
- <span>{{ topic.nb_datasets }}</span>
76
- </div>
77
-
78
- <div
79
- v-if="topic.nb_dataservices"
80
- class="flex items-center gap-1"
81
- >
82
- <RiTerminalLine
83
- aria-hidden="true"
84
- class="size-4"
64
+ <ObjectCardMetric
65
+ v-if="topic.nb_dataservices !== undefined"
66
+ :icon="RiTerminalLine"
67
+ :value="topic.nb_dataservices"
68
+ :label="t('{n} API', topic.nb_dataservices)"
85
69
  />
86
- <span>{{ topic.nb_dataservices }}</span>
87
- </div>
88
-
89
- <div
90
- v-if="topic.nb_reuses"
91
- class="flex items-center gap-1"
92
- >
93
- <RiLineChartLine
94
- aria-hidden="true"
95
- class="size-4"
70
+ <ObjectCardMetric
71
+ v-if="topic.nb_reuses !== undefined"
72
+ :icon="RiLineChartLine"
73
+ :value="topic.nb_reuses"
74
+ :label="t('{n} réutilisations | {n} réutilisation | {n} réutilisations', topic.nb_reuses)"
96
75
  />
97
- <span>{{ topic.nb_reuses }}</span>
98
- </div>
99
- </div>
100
-
76
+ </ObjectCardMetrics>
77
+ </ObjectCardMeta>
78
+ <ObjectCardShortDescription
79
+ :text="topic.description"
80
+ class="max-md:hidden"
81
+ />
101
82
  <slot />
102
83
  </ObjectCard>
103
84
  </template>
104
85
 
105
86
  <script setup lang="ts">
106
- import { RiBookShelfLine, RiDatabase2Line, RiLineChartLine, RiSubtractLine, RiTerminalLine } from '@remixicon/vue'
87
+ import { computed } from 'vue'
88
+ import { RiBookShelfLine, RiDatabase2Line, RiLineChartLine, RiTerminalLine } from '@remixicon/vue'
107
89
  import type { RouteLocationRaw } from 'vue-router'
108
90
  import type { TopicV2 } from '../types/topics'
109
- import ObjectCardHeader from './ObjectCardHeader.vue'
91
+ import { useTranslation } from '../composables/useTranslation'
92
+ import Avatar from './Avatar.vue'
93
+ import FormattedDate from './FormattedDate.vue'
94
+ import ObjectCard from './ObjectCard.vue'
95
+ import ObjectCardMeta from './ObjectCardMeta.vue'
96
+ import ObjectCardMetric from './ObjectCardMetric.vue'
97
+ import ObjectCardMetrics from './ObjectCardMetrics.vue'
110
98
  import ObjectCardOwner from './ObjectCardOwner.vue'
111
99
  import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
112
100
  import OrganizationLogo from './OrganizationLogo.vue'
113
- import Avatar from './Avatar.vue'
114
101
  import Placeholder from './Placeholder.vue'
115
- import ObjectCard from './ObjectCard.vue'
116
- import FormattedDate from './FormattedDate.vue'
117
102
  import TranslationT from './TranslationT.vue'
118
103
 
119
104
  type TopicWithStats = TopicV2 & {
@@ -122,14 +107,20 @@ type TopicWithStats = TopicV2 & {
122
107
  nb_reuses?: number
123
108
  }
124
109
 
125
- withDefaults(defineProps<{
126
- topic: TopicWithStats
127
- topicUrl?: RouteLocationRaw
128
- organizationUrl?: RouteLocationRaw | null
129
- showLogo?: boolean
130
- showStats?: boolean
131
- }>(), {
132
- showLogo: true,
133
- showStats: true,
134
- })
110
+ const props = withDefaults(
111
+ defineProps<{
112
+ topic: TopicWithStats
113
+ topicUrl?: RouteLocationRaw
114
+ organizationUrl?: RouteLocationRaw | null
115
+ showLogo?: boolean
116
+ showStats?: boolean
117
+ }>(),
118
+ {
119
+ showLogo: true,
120
+ showStats: true,
121
+ },
122
+ )
123
+ const { t } = useTranslation()
124
+
125
+ const hasStats = computed(() => props.topic.nb_datasets !== undefined || props.topic.nb_dataservices !== undefined || props.topic.nb_reuses !== undefined)
135
126
  </script>
package/src/main.ts CHANGED
@@ -69,7 +69,6 @@ import LabelTag from './components/DatasetLabelTag.vue'
69
69
  import LoadingBlock from './components/LoadingBlock.vue'
70
70
  import MarkdownViewer from './components/MarkdownViewer.vue'
71
71
  import OrganizationCard from './components/OrganizationCard.vue'
72
- import OrganizationHorizontalCard from './components/OrganizationHorizontalCard.vue'
73
72
  import ObjectCardOwner from './components/ObjectCardOwner.vue'
74
73
  import OrganizationLogo from './components/OrganizationLogo.vue'
75
74
  import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
@@ -90,7 +89,6 @@ import ResourceExplorerSidebar from './components/ResourceExplorer/ResourceExplo
90
89
  import ResourceExplorerViewer from './components/ResourceExplorer/ResourceExplorerViewer.vue'
91
90
  import OpenApiViewer from './components/OpenApiViewer/OpenApiViewer.vue'
92
91
  import ReuseCard from './components/ReuseCard.vue'
93
- import ReuseHorizontalCard from './components/ReuseHorizontalCard.vue'
94
92
  import ReuseDetails from './components/ReuseDetails.vue'
95
93
  import SchemaCard from './components/SchemaCard.vue'
96
94
  import SimpleBanner from './components/SimpleBanner.vue'
@@ -399,7 +397,6 @@ export {
399
397
  Tag,
400
398
  MarkdownViewer,
401
399
  OrganizationCard,
402
- OrganizationHorizontalCard,
403
400
  OrganizationLogo,
404
401
  OrganizationNameWithCertificate,
405
402
  OwnerType,
@@ -421,7 +418,6 @@ export {
421
418
  ResourceSelector,
422
419
  ReuseCard,
423
420
  ReuseDetails,
424
- ReuseHorizontalCard,
425
421
  SchemaCard,
426
422
  SimpleBanner,
427
423
  StatBox,
@@ -1,42 +0,0 @@
1
- <template>
2
- <component
3
- :is="titleTag"
4
- class="w-full text-base font-bold flex"
5
- >
6
- <AppLink
7
- :to="url"
8
- class="text-gray-title text-base bg-none flex items-center w-full truncate gap-1"
9
- :target="target"
10
- >
11
- <component
12
- :is="icon"
13
- aria-hidden="true"
14
- class="size-4 flex-none"
15
- />
16
- <span
17
- class="block truncate"
18
- :class="$slots.extra ? 'flex-initial' : 'flex-1'"
19
- >
20
- <slot />
21
- </span>
22
- <slot name="extra" />
23
- <span class="absolute inset-0" />
24
- </AppLink>
25
- </component>
26
- </template>
27
-
28
- <script setup lang="ts">
29
- import type { Component } from 'vue'
30
- import type { RouteLocationRaw } from 'vue-router'
31
- import type { TitleTag } from '../types/ui'
32
- import AppLink from './AppLink.vue'
33
-
34
- withDefaults(defineProps<{
35
- icon: Component
36
- url: RouteLocationRaw
37
- target?: string
38
- titleTag?: TitleTag
39
- }>(), {
40
- titleTag: 'h3',
41
- })
42
- </script>
@@ -1,87 +0,0 @@
1
- <template>
2
- <ObjectCard>
3
- <template #media>
4
- <OrganizationLogo
5
- :organization="organization"
6
- size-class="size-12"
7
- />
8
- </template>
9
- <ObjectCardHeader
10
- :icon="RiBuilding2Line"
11
- :url="organization.page"
12
- >
13
- <OrganizationNameWithCertificate
14
- :show-type="false"
15
- :organization
16
- size="sm"
17
- color-class="text-gray-title"
18
- />
19
- </ObjectCardHeader>
20
- <div class="text-sm flex flex-wrap md:flex-nowrap gap-y-1 items-center truncate">
21
- <template v-if="type !== 'other'">
22
- <OwnerType
23
- class="mb-0"
24
- :type
25
- />
26
- <RiSubtractLine
27
- v-if="'metrics' in organization"
28
- aria-hidden="true"
29
- class="hidden md:block size-4 flex-none fill-gray-medium"
30
- />
31
- </template>
32
- <div
33
- v-if="'metrics' in organization"
34
- class="text-gray-medium flex items-center text-sm gap-0.5"
35
- :aria-label="t('{datasets} jeux de donn\u00e9es, {dataservices} API et {reuses} r\u00e9utilisations', {
36
- datasets: organization.metrics.datasets,
37
- dataservices: organization.metrics.dataservices,
38
- reuses: organization.metrics.reuses,
39
- })"
40
- >
41
- <RiDatabase2Line
42
- aria-hidden="true"
43
- class="size-3.5"
44
- /> {{ summarize(organization.metrics.datasets) }}
45
- <RiTerminalLine
46
- aria-hidden="true"
47
- class="size-3.5 ml-1"
48
- /> {{ summarize(organization.metrics.dataservices) }}
49
- <RiLineChartLine
50
- aria-hidden="true"
51
- class="size-3.5 ml-1"
52
- /> {{ summarize(organization.metrics.reuses) }}
53
- <RiStarLine
54
- aria-hidden="true"
55
- class="size-3.5 ml-1"
56
- /> {{ summarize(organization.metrics.followers) }}
57
- </div>
58
- </div>
59
- <ObjectCardShortDescription
60
- v-if="'description' in organization"
61
- :text="organization.description"
62
- />
63
- </ObjectCard>
64
- </template>
65
-
66
- <script setup lang="ts">
67
- import { RiBuilding2Line, RiDatabase2Line, RiLineChartLine, RiStarLine, RiSubtractLine, RiTerminalLine } from '@remixicon/vue'
68
- import { computed } from 'vue'
69
- import { getOrganizationType } from '../functions/organizations'
70
- import { summarize } from '../functions/helpers'
71
- import { useTranslation } from '../composables/useTranslation'
72
- import type { Organization, OrganizationReference } from '../types/organizations'
73
- import OrganizationLogo from './OrganizationLogo.vue'
74
- import OrganizationNameWithCertificate from './OrganizationNameWithCertificate.vue'
75
- import OwnerType from './OwnerType.vue'
76
- import ObjectCard from './ObjectCard.vue'
77
- import ObjectCardHeader from './ObjectCardHeader.vue'
78
- import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
79
-
80
- const props = defineProps<{
81
- organization: Organization | OrganizationReference
82
- }>()
83
-
84
- const { t } = useTranslation()
85
-
86
- const type = computed(() => getOrganizationType(props.organization))
87
- </script>
@@ -1,81 +0,0 @@
1
- <template>
2
- <ObjectCard media-size="lg">
3
- <template #badge>
4
- <ObjectCardBadge
5
- v-if="reuse.private"
6
- :icon="RiLockLine"
7
- >
8
- {{ t('Brouillon') }}
9
- </ObjectCardBadge>
10
- <ObjectCardBadge
11
- v-else-if="reuse.archived"
12
- :icon="RiArchiveLine"
13
- >
14
- {{ t('Archivé') }}
15
- </ObjectCardBadge>
16
- </template>
17
-
18
- <template #media>
19
- <img
20
- v-if="reuse.image"
21
- :src="reuse.image"
22
- class="w-full h-full object-cover"
23
- :alt="reuse.title"
24
- >
25
- <Placeholder
26
- v-else
27
- type="Reuse"
28
- class="w-full h-full"
29
- />
30
- </template>
31
-
32
- <ObjectCardHeader
33
- :icon="RiLineChartLine"
34
- :url="reuseUrl || reuse.page"
35
- >
36
- {{ reuse.title }}
37
- </ObjectCardHeader>
38
-
39
- <div
40
- v-if="reuse.organization || reuse.owner"
41
- class="text-sm flex flex-wrap md:flex-nowrap gap-y-1 items-center truncate"
42
- >
43
- <ObjectCardOwner
44
- :organization="reuse.organization"
45
- :owner="reuse.owner"
46
- :organization-url="organizationUrl"
47
- />
48
- </div>
49
-
50
- <div class="mx-0 -mb-1 flex flex-wrap items-center text-sm text-gray-medium mt-1">
51
- <ReuseDetails :reuse />
52
- </div>
53
-
54
- <ObjectCardShortDescription :text="reuse.description" />
55
-
56
- <slot />
57
- </ObjectCard>
58
- </template>
59
-
60
- <script setup lang="ts">
61
- import { RiArchiveLine, RiLineChartLine, RiLockLine } from '@remixicon/vue'
62
- import type { RouteLocationRaw } from 'vue-router'
63
- import type { Reuse, ReuseV2 } from '../types/reuses'
64
- import { useTranslation } from '../composables/useTranslation'
65
- import ReuseDetails from './ReuseDetails.vue'
66
- import Placeholder from './Placeholder.vue'
67
- import ObjectCard from './ObjectCard.vue'
68
- import ObjectCardHeader from './ObjectCardHeader.vue'
69
- import ObjectCardOwner from './ObjectCardOwner.vue'
70
- import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
71
- import ObjectCardBadge from './ObjectCardBadge.vue'
72
-
73
- defineProps<{
74
- reuse: Reuse | ReuseV2
75
- reuseUrl?: RouteLocationRaw
76
- // undefined falls back to the organization's data.gouv.fr page; pass null to render plain, non-linked text
77
- organizationUrl?: RouteLocationRaw | null
78
- }>()
79
-
80
- const { t } = useTranslation()
81
- </script>