@datagouv/components-next 1.0.2-dev.205 → 1.0.2-dev.207

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.
@@ -1,4 +1,4 @@
1
- import { g as Ke } from "./main-CICNrWF8.js";
1
+ import { g as Ke } from "./main-DADRUTDs.js";
2
2
  import We from "vue";
3
3
  function Fe(I, K) {
4
4
  for (var V = 0; V < K.length; V++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.0.2-dev.205",
3
+ "version": "1.0.2-dev.207",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <ObjectCard media-size="xl">
3
+ <template #badge>
4
+ <ObjectCardBadge
5
+ v-if="chart.deleted_at"
6
+ :icon="RiDeleteBinLine"
7
+ >
8
+ {{ t('Supprimé') }}
9
+ </ObjectCardBadge>
10
+ <ObjectCardBadge
11
+ v-else-if="chart.private"
12
+ :icon="RiLockLine"
13
+ >
14
+ {{ t('Brouillon') }}
15
+ </ObjectCardBadge>
16
+ </template>
17
+
18
+ <template #media>
19
+ <img
20
+ v-if="chart.image"
21
+ :src="chart.image"
22
+ class="w-full h-full object-cover"
23
+ :alt="chart.title"
24
+ >
25
+ <Placeholder
26
+ v-else
27
+ type="Chart"
28
+ class="w-full h-full"
29
+ />
30
+ </template>
31
+
32
+ <ObjectCardHeader
33
+ :icon="chartIcon"
34
+ :url="chartUrl || chart.page"
35
+ >
36
+ {{ chart.title }}
37
+ </ObjectCardHeader>
38
+
39
+ <div
40
+ v-if="chart.organization || chart.owner"
41
+ class="text-sm flex flex-wrap gap-y-1 items-center truncate"
42
+ >
43
+ <ObjectCardOwner
44
+ :organization="chart.organization"
45
+ :owner="chart.owner"
46
+ :organization-url="organizationUrl"
47
+ />
48
+ <RiSubtractLine
49
+ aria-hidden="true"
50
+ class="size-4 flex-none fill-gray-medium"
51
+ />
52
+ <TranslationT
53
+ tag="p"
54
+ class="text-sm whitespace-nowrap mb-0 text-gray-medium"
55
+ keypath="Mis à jour {date}"
56
+ >
57
+ <template #date>
58
+ <FormattedDate
59
+ :date="chart.last_modified"
60
+ format="relative"
61
+ :options="{ dateStyle: 'medium' }"
62
+ />
63
+ </template>
64
+ </TranslationT>
65
+ </div>
66
+
67
+ <div class="mx-0 -mb-1 flex flex-wrap items-center text-sm text-gray-medium mt-1">
68
+ <p
69
+ class="text-sm mb-0 flex items-center gap-0.5"
70
+ :aria-label="t('{n} vues | {n} vue | {n} vues', chart.metrics.views)"
71
+ >
72
+ <RiEyeLine
73
+ aria-hidden="true"
74
+ class="size-3.5"
75
+ />{{ summarize(chart.metrics.views) }}
76
+ </p>
77
+ </div>
78
+
79
+ <ObjectCardShortDescription :text="chart.description" />
80
+
81
+ <slot />
82
+ </ObjectCard>
83
+ </template>
84
+
85
+ <script setup lang="ts">
86
+ import { computed } from 'vue'
87
+ import { RiBarChartBoxLine, RiDeleteBinLine, RiEyeLine, RiLineChartLine, RiLockLine, RiSubtractLine } from '@remixicon/vue'
88
+ import type { RouteLocationRaw } from 'vue-router'
89
+ import type { Chart } from '../types/visualizations'
90
+ import { summarize } from '../functions/helpers'
91
+ import { useTranslation } from '../composables/useTranslation'
92
+ import Placeholder from './Placeholder.vue'
93
+ import FormattedDate from './FormattedDate.vue'
94
+ import ObjectCard from './ObjectCard.vue'
95
+ import ObjectCardBadge from './ObjectCardBadge.vue'
96
+ import ObjectCardHeader from './ObjectCardHeader.vue'
97
+ import ObjectCardOwner from './ObjectCardOwner.vue'
98
+ import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
99
+ import TranslationT from './TranslationT.vue'
100
+
101
+ const props = defineProps<{
102
+ chart: Chart
103
+ chartUrl?: RouteLocationRaw
104
+ organizationUrl?: RouteLocationRaw
105
+ }>()
106
+
107
+ const { t } = useTranslation()
108
+
109
+ const chartIcon = computed(() => {
110
+ return props.chart.series[0]?.type === 'line' ? RiLineChartLine : RiBarChartBoxLine
111
+ })
112
+ </script>
@@ -28,12 +28,15 @@ import { computed } from 'vue'
28
28
 
29
29
  const props = withDefaults(defineProps<{
30
30
  articleClass?: string | string[] | Record<string, boolean>
31
- mediaSize?: 'sm' | 'lg'
31
+ mediaSize?: 'sm' | 'lg' | 'xl'
32
32
  }>(), {
33
33
  mediaSize: 'sm',
34
34
  })
35
35
 
36
36
  const mediaContainerClass = computed(() => {
37
+ if (props.mediaSize === 'xl') {
38
+ return 'w-[250px] h-[190px]'
39
+ }
37
40
  if (props.mediaSize === 'lg') {
38
41
  return 'w-[225px] h-[120px]'
39
42
  }
@@ -10,10 +10,10 @@
10
10
 
11
11
  <script setup lang="ts">
12
12
  import { computed } from 'vue'
13
- import { RiBookShelfLine, RiBuilding2Line, RiDatabase2Line, RiLineChartLine, RiTerminalLine } from '@remixicon/vue'
13
+ import { RiBarChartBoxLine, RiBookShelfLine, RiBuilding2Line, RiDatabase2Line, RiLineChartLine, RiTerminalLine } from '@remixicon/vue'
14
14
 
15
15
  const props = defineProps<{
16
- type: 'Dataset' | 'Dataservice' | 'Reuse' | 'Organization' | 'Topic'
16
+ type: 'Dataset' | 'Dataservice' | 'Reuse' | 'Organization' | 'Topic' | 'Chart'
17
17
  }>()
18
18
 
19
19
  const icon = computed(() => {
@@ -23,6 +23,7 @@ const icon = computed(() => {
23
23
  Reuse: RiLineChartLine,
24
24
  Organization: RiBuilding2Line,
25
25
  Topic: RiBookShelfLine,
26
+ Chart: RiBarChartBoxLine,
26
27
  }[props.type]
27
28
  })
28
29
  </script>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
+ import { RiInformationLine } from '@remixicon/vue'
3
4
  import type { Resource } from '../../types/resources'
4
5
  import CopyButton from '../CopyButton.vue'
5
6
  import DescriptionDetails from '../DescriptionDetails.vue'
@@ -7,6 +8,7 @@ import DescriptionTerm from '../DescriptionTerm.vue'
7
8
  import FormattedDate from '../FormattedDate.vue'
8
9
  import { filesize } from '../../functions/helpers'
9
10
  import ExtraAccordion from '../ExtraAccordion.vue'
11
+ import Toggletip from '../Toggletip.vue'
10
12
  import { getResourceTitleId, getResourceLabel, getResourceFilesize } from '../../functions/resources'
11
13
  import { useTranslation } from '../../composables/useTranslation'
12
14
 
@@ -41,8 +43,23 @@ const { t } = useTranslation()
41
43
  </a>
42
44
  </code>
43
45
  </DescriptionDetails>
44
- <DescriptionTerm>
46
+ <DescriptionTerm class="flex items-center">
45
47
  {{ t('URL stable') }}
48
+ <Toggletip
49
+ :styled-button="false"
50
+ button-class="ml-1 border-transparent -outline-offset-2 inline-flex items-center justify-center rounded-sm p-1 text-gray-medium hover:bg-gray-lower transition-colors"
51
+ >
52
+ <RiInformationLine
53
+ class="size-4"
54
+ aria-hidden="true"
55
+ />
56
+ <span class="sr-only">{{ t(`Qu'est-ce qu'une URL stable ?`) }}</span>
57
+ <template #toggletip>
58
+ <p class="fr-text--sm m-0">
59
+ {{ t(`Cette URL redirige toujours vers la dernière version du fichier. L'URL du fichier, elle, change à chaque mise à jour : privilégiez l'URL stable pour partager la ressource ou l'utiliser dans un script.`) }}
60
+ </p>
61
+ </template>
62
+ </Toggletip>
46
63
  <CopyButton
47
64
  :label="t(`Copier l'URL stable`)"
48
65
  :copied-label="t('URL stable copiée !')"
package/src/main.ts CHANGED
@@ -38,6 +38,7 @@ import Avatar from './components/Avatar.vue'
38
38
  import AvatarWithName from './components/AvatarWithName.vue'
39
39
  import BannerAction from './components/BannerAction.vue'
40
40
  import BrandedButton from './components/BrandedButton.vue'
41
+ import ChartCard from './components/ChartCard.vue'
41
42
  import CopyButton from './components/CopyButton.vue'
42
43
  import DataserviceCard from './components/DataserviceCard.vue'
43
44
  import DataserviceQuality from './components/DataserviceQuality.vue'
@@ -344,6 +345,7 @@ export {
344
345
  AvatarWithName,
345
346
  BannerAction,
346
347
  BrandedButton,
348
+ ChartCard,
347
349
  CopyButton,
348
350
  DataserviceCard,
349
351
  DataserviceQuality,
@@ -67,6 +67,7 @@ export type Chart = Owned & {
67
67
  created_at: string
68
68
  last_modified: string
69
69
  deleted_at: string | null
70
+ image: string | null
70
71
  uri: string
71
72
  page: string
72
73
  x_axis: XAxis