@datagouv/components-next 1.0.2-dev.91 → 1.0.2-dev.93

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 { c as Ke } from "./main-Dk_66g-3.js";
1
+ import { c as Ke } from "./main-DEpfIocP.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.91",
3
+ "version": "1.0.2-dev.93",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -53,6 +53,7 @@
53
53
  <ObjectCardHeader
54
54
  :icon="isTabularApi ? RiSparklingLine : RiTerminalLine"
55
55
  :url="dataserviceUrl || dataservice.self_web_url"
56
+ :title-tag="titleTag"
56
57
  >
57
58
  {{ dataservice.title }}
58
59
  </ObjectCardHeader>
@@ -115,6 +116,7 @@ import { useComponentsConfig } from '../config'
115
116
  import { useFormatDate } from '../functions/dates'
116
117
  import { summarize } from '../functions/helpers'
117
118
  import type { Dataservice } from '../types/dataservices'
119
+ import type { TitleTag } from '../types/ui'
118
120
  import { useTranslation } from '../composables/useTranslation'
119
121
  import OrganizationLogo from './OrganizationLogo.vue'
120
122
  import Avatar from './Avatar.vue'
@@ -130,6 +132,7 @@ type Props = {
130
132
  dataserviceUrl?: RouteLocationRaw
131
133
  organizationUrl?: RouteLocationRaw
132
134
  showDescription?: boolean
135
+ titleTag?: TitleTag
133
136
  }
134
137
 
135
138
  const props = withDefaults(defineProps<Props>(), {
@@ -36,6 +36,7 @@
36
36
  :icon="RiDatabase2Line"
37
37
  :url="datasetUrl || dataset.page"
38
38
  :target="datasetUrlInNewTab ? '_blank' : undefined"
39
+ :title-tag="titleTag"
39
40
  >
40
41
  {{ dataset.title }}
41
42
  <template
@@ -117,6 +118,7 @@
117
118
  import type { RouteLocationRaw } from 'vue-router'
118
119
  import { RiArchiveLine, RiDatabase2Line, RiDownloadLine, RiEyeLine, RiLineChartLine, RiLockLine, RiStarLine, RiSubtractLine } from '@remixicon/vue'
119
120
  import type { Dataset, DatasetV2 } from '../types/datasets'
121
+ import type { TitleTag } from '../types/ui'
120
122
  import { summarize } from '../functions/helpers'
121
123
  import { useFormatDate } from '../functions/dates'
122
124
  import { getDescriptionShort } from '../functions/description'
@@ -137,6 +139,7 @@ type Props = {
137
139
  datasetUrlInNewTab?: boolean
138
140
  organizationUrl?: RouteLocationRaw
139
141
  showDescriptionShort?: boolean
142
+ titleTag?: TitleTag
140
143
  }
141
144
 
142
145
  const props = withDefaults(defineProps<Props>(), {
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <h3 class="w-full text-base flex">
2
+ <component
3
+ :is="titleTag"
4
+ class="w-full text-base flex"
5
+ >
3
6
  <AppLink
4
7
  :to="url"
5
8
  class="text-gray-title text-base bg-none flex items-center w-full truncate gap-1"
@@ -19,17 +22,21 @@
19
22
  <slot name="extra" />
20
23
  <span class="absolute inset-0" />
21
24
  </AppLink>
22
- </h3>
25
+ </component>
23
26
  </template>
24
27
 
25
28
  <script setup lang="ts">
26
29
  import type { Component } from 'vue'
27
30
  import type { RouteLocationRaw } from 'vue-router'
31
+ import type { TitleTag } from '../types/ui'
28
32
  import AppLink from './AppLink.vue'
29
33
 
30
- defineProps<{
34
+ withDefaults(defineProps<{
31
35
  icon: Component
32
36
  url: RouteLocationRaw
33
37
  target?: string
34
- }>()
38
+ titleTag?: TitleTag
39
+ }>(), {
40
+ titleTag: 'h3',
41
+ })
35
42
  </script>
@@ -2,14 +2,17 @@
2
2
  <article class="fr-enlarge-link group/reuse-card bg-white border border-gray-default hover:bg-gray-some flex flex-col relative">
3
3
  <div class="flex flex-col h-full flex-1 order-2 px-8">
4
4
  <div class="order-1 flex flex-col px-4 py-1 h-full -mx-8">
5
- <h3 class="font-bold text-base mt-1 mb-0 truncate">
5
+ <component
6
+ :is="titleTag"
7
+ class="font-bold text-base mt-1 mb-0 truncate"
8
+ >
6
9
  <AppLink
7
10
  class="text-gray-title overflow-hidden"
8
11
  :to="reuseUrl"
9
12
  >
10
13
  {{ reuse.title }}
11
14
  </AppLink>
12
- </h3>
15
+ </component>
13
16
  <div class="order-3 text-sm m-0 text-gray-medium">
14
17
  <div class="text-sm mb-0 flex items-center">
15
18
  <ObjectCardOwner
@@ -66,13 +69,14 @@ import { computed } from 'vue'
66
69
  import type { RouteLocationRaw } from 'vue-router'
67
70
  import { useFormatDate } from '../functions/dates'
68
71
  import type { Reuse } from '../types/reuses'
72
+ import type { TitleTag } from '../types/ui'
69
73
  import { useTranslation } from '../composables/useTranslation'
70
74
  import AppLink from './AppLink.vue'
71
75
  import ObjectCardOwner from './ObjectCardOwner.vue'
72
76
  import ReuseDetails from './ReuseDetails.vue'
73
77
  import Placeholder from './Placeholder.vue'
74
78
 
75
- const props = defineProps<{
79
+ const props = withDefaults(defineProps<{
76
80
  reuse: Reuse
77
81
 
78
82
  /**
@@ -86,7 +90,11 @@ const props = defineProps<{
86
90
  * It is used as a separate prop to allow other sites using the package to define their own organization pages.
87
91
  */
88
92
  organizationUrl?: RouteLocationRaw
89
- }>()
93
+
94
+ titleTag?: TitleTag
95
+ }>(), {
96
+ titleTag: 'h3',
97
+ })
90
98
 
91
99
  const { t } = useTranslation()
92
100
  const { formatRelativeIfRecentDate } = useFormatDate()
package/src/types/ui.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export type WellType = 'primary' | 'secondary'
2
2
 
3
3
  export type Weight = 'light' | 'regular' | 'semi-bold' | 'bold' | 'heavy'
4
+
5
+ export type TitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'