@datagouv/components-next 1.5.1-dev.1397.g7333a397 → 1.5.1-dev.1399.g35c3eb9f

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 (59) hide show
  1. package/dist/{Control-DPuXeUqi.js → Control-BbyEe8x_.js} +7 -7
  2. package/dist/{Datafair.client-LlEgG7WU.js → Datafair.client-CQNxPvZt.js} +1 -1
  3. package/dist/{Image-DVWRoLLI.js → Image-umPJvSA8.js} +16 -13
  4. package/dist/{ImagePreview.client-Db5dmxMP.js → ImagePreview.client-DbkBb47d.js} +1 -1
  5. package/dist/{JsonPreview.client-DKy2AexC.js → JsonPreview.client-Ba-_lUCj.js} +2 -2
  6. package/dist/{Layer-D_5tYbVm.js → Layer-CagLskq_.js} +67 -61
  7. package/dist/{Map-CTBJEae_.js → Map-Cek3vwVi.js} +1094 -932
  8. package/dist/{MapContainer.client-DoN1jSzM.js → MapContainer.client-BsJGdnP2.js} +7 -7
  9. package/dist/{OSM-B5Zc3qAf.js → OSM-Bm69tJpi.js} +1 -1
  10. package/dist/{PdfPreview.client-D3wHTDb9.js → PdfPreview.client-CJbZbXds.js} +3 -3
  11. package/dist/{PdfSkeleton-nas5Pmia.js → PdfSkeleton-sY8nI3Lv.js} +1 -1
  12. package/dist/{Pmtiles.client-DncYrZSp.js → Pmtiles.client-Wea3YvTU.js} +9997 -9276
  13. package/dist/{PreviewError-EeaGx3SL.js → PreviewError-BzUvwX47.js} +329 -290
  14. package/dist/{PreviewWrapper-BhldDdXK.js → PreviewWrapper-CwOJqQSn.js} +1 -1
  15. package/dist/{ScaleLine-C_tuJ6VG.js → ScaleLine-C8xmHdEk.js} +15 -8
  16. package/dist/Tile-DfivRbb3.js +479 -0
  17. package/dist/{Tile-8nHSuqcv.js → Tile-DvVc2IeI.js} +220 -151
  18. package/dist/{TileImage-CgO5alXc.js → TileImage-CxC7EP7_.js} +53 -45
  19. package/dist/{View-Dad8DfSD.js → View-44C9US2-.js} +210 -208
  20. package/dist/{XmlPreview.client-CmGbc3c3.js → XmlPreview.client-xXdnrUCW.js} +2 -2
  21. package/dist/assets/maplibre-gl-worker-Dlv-oLtU.js +10 -0
  22. package/dist/components-next.css +1 -1
  23. package/dist/components-next.js +11889 -10504
  24. package/dist/components.css +2 -2
  25. package/dist/{france-BtSQqcqV.js → france-BYzDEL-I.js} +23 -23
  26. package/dist/{proj-COhZ08DR.js → proj-0ED4AWuV.js} +260 -246
  27. package/dist/purify.es-D-UgLNEK.js +848 -0
  28. package/dist/{src-DJJgtynU.js → src-DdUvT8zT.js} +1972 -1306
  29. package/dist/{transform-CNeEnSK9.js → transform-bRfffInI.js} +3 -3
  30. package/package.json +18 -18
  31. package/src/components/AccessTypeBadge.vue +46 -0
  32. package/src/components/Badge.vue +74 -0
  33. package/src/components/ChartBadge.vue +17 -0
  34. package/src/components/ChartCard.vue +4 -17
  35. package/src/components/DataserviceBadge.vue +17 -0
  36. package/src/components/DataserviceCard.vue +12 -31
  37. package/src/components/DatasetBadge.vue +17 -0
  38. package/src/components/DatasetCard.vue +11 -15
  39. package/src/components/DatasetInformation/DatasetInformationSection.vue +3 -7
  40. package/src/components/DatasetInformation/DatasetSchemaSection.vue +1 -4
  41. package/src/components/DatasetLabelTag.vue +4 -15
  42. package/src/components/Form/SelectGroup.vue +0 -2
  43. package/src/components/LicenseBadge.vue +7 -12
  44. package/src/components/ObjectStatusBadge.vue +47 -0
  45. package/src/components/OrganizationBadge.vue +24 -0
  46. package/src/components/OrganizationTypeBadge.vue +5 -4
  47. package/src/components/ResourceAccordion/SchemaBadge.vue +6 -2
  48. package/src/components/ReuseBadge.vue +17 -0
  49. package/src/components/ReuseCard.vue +5 -20
  50. package/src/components/SchemaCard.vue +1 -5
  51. package/src/components/StatBox.vue +5 -3
  52. package/src/components/Tag.vue +61 -15
  53. package/src/functions/objectStatus.ts +34 -0
  54. package/src/main.ts +25 -3
  55. package/src/types/ui.ts +2 -0
  56. package/dist/Tile-Bu5lF4M5.js +0 -463
  57. package/dist/assets/maplibre-gl-worker-CEzvAyZY.js +0 -10
  58. package/dist/purify.es-eElsWhh7.js +0 -876
  59. package/src/components/ObjectCardBadge.vue +0 -33
@@ -1,4 +1,4 @@
1
- import { At as e, ht as t, kt as n, mt as r, ot as i } from "./proj-COhZ08DR.js";
1
+ import { At as e, gt as t, ht as n, jt as r, st as i } from "./proj-0ED4AWuV.js";
2
2
  // ../node_modules/ol/easing.js
3
3
  function a(e) {
4
4
  return e ** 3;
@@ -52,8 +52,8 @@ function m(e, t, n, r, i) {
52
52
  }
53
53
  // ../node_modules/ol/geom/flat/intersectsextent.js
54
54
  function h(t, a, o, s, c, l) {
55
- return l ??= r(i(), t, a, o, s), n(c, l) ? l[0] >= c[0] && l[2] <= c[2] || l[1] >= c[1] && l[3] <= c[3] || m(t, a, o, s, function(t, n) {
56
- return e(c, t, n);
55
+ return l ??= n(i(), t, a, o, s), e(c, l) ? l[0] >= c[0] && l[2] <= c[2] || l[1] >= c[1] && l[3] <= c[3] || m(t, a, o, s, function(e, t) {
56
+ return r(c, e, t);
57
57
  }) : !1;
58
58
  }
59
59
  function g(e, t, n, r, i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.5.1-dev.1397.g7333a397",
3
+ "version": "1.5.1-dev.1399.g35c3eb9f",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -31,14 +31,14 @@
31
31
  "@types/leaflet": "^1.9.22",
32
32
  "@vueuse/core": "^14.4.0",
33
33
  "@vueuse/router": "^14.4.0",
34
- "chart.js": "^4.5.1",
35
- "dompurify": "^3.4.17",
34
+ "chart.js": "^4.6.1",
35
+ "dompurify": "^3.4.18",
36
36
  "echarts": "^6.1.0",
37
37
  "geopf-extensions-openlayers": "1.0.0-beta.15",
38
38
  "leaflet": "^1.9.4",
39
- "maplibre-gl": "^6.13.0",
39
+ "maplibre-gl": "^6.18.0",
40
40
  "ofetch": "^1.5.1",
41
- "ol": "^10.10.0",
41
+ "ol": "^10.11.0",
42
42
  "pdfjs-dist": "^4.10.38",
43
43
  "pmtiles": "^4.5.0",
44
44
  "popmotion": "^11.0.5",
@@ -48,7 +48,7 @@
48
48
  "rehype-sanitize": "^6.0.0",
49
49
  "rehype-slug": "^6.0.0",
50
50
  "rehype-stringify": "^10.0.1",
51
- "reka-ui": "^2.10.4",
51
+ "reka-ui": "^2.11.0",
52
52
  "remark-behead": "^3.1.0",
53
53
  "remark-breaks": "^4.0.0",
54
54
  "remark-gfm": "^4.0.1",
@@ -57,36 +57,36 @@
57
57
  "strip-markdown": "^6.0.0",
58
58
  "stylefire": "^7.0.3",
59
59
  "unified": "^11.0.5",
60
- "unist-util-visit": "^5.1.0",
60
+ "unist-util-visit": "^5.2.0",
61
61
  "vue-content-loader": "^2.0.1",
62
62
  "vue-sonner": "^2.0.9",
63
63
  "vue3-json-viewer": "^2.4.1",
64
64
  "vue3-text-clamp": "^0.1.2",
65
65
  "vue3-xml-viewer": "^0.0.14",
66
- "yaml": "^2.9.0"
66
+ "yaml": "^2.9.1"
67
67
  },
68
68
  "devDependencies": {
69
- "@tailwindcss/cli": "^4.3.3",
69
+ "@tailwindcss/cli": "^4.3.5",
70
70
  "@tailwindcss/typography": "^0.5.20",
71
- "@tsconfig/node22": "^22.0.6",
71
+ "@tsconfig/node22": "^22.0.7",
72
72
  "@types/geojson": "^7946.0.16",
73
- "@types/node": "^22.20.2",
74
- "@vitejs/plugin-vue": "^6.0.8",
73
+ "@types/node": "^22.20.5",
74
+ "@vitejs/plugin-vue": "^6.0.11",
75
75
  "@vue/eslint-config-prettier": "^10.2.0",
76
76
  "@vue/eslint-config-typescript": "^14.9.0",
77
77
  "@vue/tsconfig": "^0.8.1",
78
78
  "eslint": "^9.39.5",
79
- "eslint-plugin-vue": "^10.11.0",
79
+ "eslint-plugin-vue": "^10.12.1",
80
80
  "jiti": "^2.7.0",
81
81
  "npm-run-all2": "^8.0.4",
82
82
  "openapi-types": "^12.1.3",
83
- "prettier": "^3.9.6",
84
- "tailwindcss": "^4.3.3",
83
+ "prettier": "^3.10.1",
84
+ "tailwindcss": "^4.3.5",
85
85
  "typescript": "^5.9.3",
86
- "vite": "^8.3.5",
86
+ "vite": "^8.3.8",
87
87
  "vite-plugin-vue-devtools": "^8.2.1",
88
- "vue": "^3.5.42",
89
- "vue-router": "^5.3.1",
88
+ "vue": "^3.5.45",
89
+ "vue-router": "^5.5.1",
90
90
  "vue-tsc": "3.3.11"
91
91
  },
92
92
  "peerDependencies": {
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <Badge
3
+ :size
4
+ :tone="display.tone"
5
+ :icon="bare ? null : display.icon"
6
+ :medium="!bare"
7
+ >
8
+ {{ display.label }}
9
+ </Badge>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { RiLockLine, RiPassValidLine } from '@remixicon/vue'
14
+ import { computed, type Component } from 'vue'
15
+ import { useTranslation } from '../composables/useTranslation'
16
+ import { throwOnNever } from '../functions/never'
17
+ import type { AccessType } from '../types/access_types'
18
+ import type { BadgeTone } from '../types/ui'
19
+ import Badge from './Badge.vue'
20
+
21
+ const props = withDefaults(defineProps<{
22
+ accessType: AccessType
23
+ size?: 'xs' | 'sm'
24
+ // Table cells show the bare label, like the other statuses next to it
25
+ bare?: boolean
26
+ }>(), {
27
+ size: 'sm',
28
+ })
29
+
30
+ const { t } = useTranslation()
31
+
32
+ type AccessTypeDisplay = { label: string, tone: BadgeTone, icon: Component | null }
33
+
34
+ const display = computed<AccessTypeDisplay>(() => {
35
+ switch (props.accessType) {
36
+ case 'open':
37
+ return { label: t('Ouvert'), tone: 'success', icon: null }
38
+ case 'open_with_account':
39
+ return { label: t('Ouvert avec un compte'), tone: 'yellow', icon: RiPassValidLine }
40
+ case 'restricted':
41
+ return { label: t('Accès restreint'), tone: 'warning', icon: RiLockLine }
42
+ default:
43
+ return throwOnNever(props.accessType, 'Unknown access type')
44
+ }
45
+ })
46
+ </script>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <component
3
+ :is="to ? AppLink : 'span'"
4
+ :to
5
+ class="inline-flex items-center gap-1 max-w-full align-middle rounded-md border border-current/20 text-xs"
6
+ :class="[toneClasses, sizeClasses, medium ? 'font-medium' : 'font-normal', { 'whitespace-nowrap': !wrap }, to && linkClasses]"
7
+ >
8
+ <component
9
+ :is="icon"
10
+ v-if="icon"
11
+ class="size-3.5 flex-none"
12
+ aria-hidden="true"
13
+ focusable="false"
14
+ />
15
+ <!-- A single-line label too long for its container ends with an ellipsis instead of overflowing the badge.
16
+ Clipping on x only: hidden would also clip y and cut the glyphs the text-box trim lets overflow -->
17
+ <span
18
+ class="min-w-0 [text-box:trim-both_cap_alphabetic]"
19
+ :class="{ 'overflow-x-clip text-ellipsis': !wrap }"
20
+ >
21
+ <slot />
22
+ </span>
23
+ <component
24
+ :is="iconRight"
25
+ v-if="iconRight"
26
+ class="size-3.5 flex-none"
27
+ aria-hidden="true"
28
+ focusable="false"
29
+ />
30
+ </component>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ import { computed, type Component } from 'vue'
35
+ import type { RouteLocationRaw } from 'vue-router'
36
+ import type { BadgeTone } from '../types/ui'
37
+ import AppLink from './AppLink.vue'
38
+
39
+ const props = withDefaults(defineProps<{
40
+ tone?: BadgeTone
41
+ size?: 'xs' | 'sm'
42
+ icon?: Component | null
43
+ iconRight?: Component | null
44
+ to?: RouteLocationRaw | null
45
+ // Business labels (access types, object statuses) are medium, plain informations stay regular
46
+ medium?: boolean
47
+ wrap?: boolean
48
+ }>(), {
49
+ tone: 'neutral',
50
+ size: 'sm',
51
+ medium: false,
52
+ wrap: false,
53
+ })
54
+
55
+ const toneClasses = computed(() => ({
56
+ neutral: 'text-gray-plain bg-gray-lower',
57
+ primary: 'text-new-info bg-new-info-light',
58
+ success: 'text-new-success bg-new-success-light',
59
+ warning: 'text-new-warning bg-new-warning-light',
60
+ yellow: 'text-warning2-dark bg-warning2-lightest',
61
+ danger: 'text-new-error bg-new-error-light',
62
+ pink: 'text-pink bg-pink-soft',
63
+ // DSFR decorative "illustration" colour, for categorical (non-status) badges
64
+ teal: 'text-new-green-illustration bg-new-green-illustration-light',
65
+ })[props.tone])
66
+
67
+ const sizeClasses = computed(() => ({
68
+ xs: 'min-h-5 py-px px-1.5 leading-4',
69
+ sm: 'min-h-6 py-0.5 px-2 leading-[18px]',
70
+ })[props.size])
71
+
72
+ // A linked badge keeps its colour: only its label is underlined on hover
73
+ const linkClasses = 'bg-none after:content-none hover:[&>span]:underline hover:[&>span]:decoration-1 hover:[&>span]:underline-offset-2 focus-visible:outline-(--border-active-blue-france)'
74
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <ObjectStatusBadge
3
+ :status="getChartStatus(chart)"
4
+ :size
5
+ />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { getChartStatus } from '../functions/objectStatus'
10
+ import type { Chart } from '../types/visualizations'
11
+ import ObjectStatusBadge from './ObjectStatusBadge.vue'
12
+
13
+ defineProps<{
14
+ chart: Chart
15
+ size?: 'xs' | 'sm'
16
+ }>()
17
+ </script>
@@ -15,22 +15,10 @@
15
15
  {{ chart.title }}
16
16
  </template>
17
17
  <template
18
- v-if="chart.deleted_at || chart.private"
18
+ v-if="getChartStatus(chart) !== 'public'"
19
19
  #badge
20
20
  >
21
- <ObjectCardBadge
22
- v-if="chart.deleted_at"
23
- :icon="RiDeleteBinLine"
24
- tone="danger"
25
- >
26
- {{ t('Supprimé') }}
27
- </ObjectCardBadge>
28
- <ObjectCardBadge
29
- v-else
30
- :icon="RiLockLine"
31
- >
32
- {{ t('Brouillon') }}
33
- </ObjectCardBadge>
21
+ <ChartBadge :chart />
34
22
  </template>
35
23
 
36
24
  <ObjectCardOwner
@@ -74,18 +62,17 @@
74
62
  import { computed } from 'vue'
75
63
  import {
76
64
  RiBarChartBoxLine,
77
- RiDeleteBinLine,
78
65
  RiEyeLine,
79
66
  RiLineChartLine,
80
- RiLockLine,
81
67
  } from '@remixicon/vue'
82
68
  import type { RouteLocationRaw } from 'vue-router'
69
+ import { getChartStatus } from '../functions/objectStatus'
83
70
  import type { Chart } from '../types/visualizations'
84
71
  import { useTranslation } from '../composables/useTranslation'
85
72
  import CardMedia from './CardMedia.vue'
73
+ import ChartBadge from './ChartBadge.vue'
86
74
  import FormattedDate from './FormattedDate.vue'
87
75
  import ObjectCard from './ObjectCard.vue'
88
- import ObjectCardBadge from './ObjectCardBadge.vue'
89
76
  import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
90
77
  import ObjectCardMeta from './ObjectCardMeta.vue'
91
78
  import ObjectCardMetric from './ObjectCardMetric.vue'
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <ObjectStatusBadge
3
+ :status="getDataserviceStatus(dataservice)"
4
+ :size
5
+ />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { getDataserviceStatus } from '../functions/objectStatus'
10
+ import type { Dataservice } from '../types/dataservices'
11
+ import ObjectStatusBadge from './ObjectStatusBadge.vue'
12
+
13
+ defineProps<{
14
+ dataservice: Dataservice
15
+ size?: 'xs' | 'sm'
16
+ }>()
17
+ </script>
@@ -26,35 +26,17 @@
26
26
  {{ dataservice.title }}
27
27
  </template>
28
28
  <template
29
- v-if="dataservice.private || dataservice.archived_at || dataservice.access_type === 'restricted' || dataservice.access_type === 'open_with_account'"
29
+ v-if="getDataserviceStatus(dataservice) !== 'public' || dataservice.access_type !== 'open'"
30
30
  #badge
31
31
  >
32
- <ObjectCardBadge
33
- v-if="dataservice.private"
34
- :icon="RiLockLine"
35
- >
36
- {{ t('Brouillon') }}
37
- </ObjectCardBadge>
38
- <ObjectCardBadge
39
- v-else-if="dataservice.archived_at"
40
- :icon="RiArchiveLine"
41
- >
42
- {{ t('Archivé') }}
43
- </ObjectCardBadge>
44
- <ObjectCardBadge
45
- v-else-if="dataservice.access_type === 'restricted'"
46
- :icon="RiLockLine"
47
- tone="warning"
48
- >
49
- {{ t('Accès restreint') }}
50
- </ObjectCardBadge>
51
- <ObjectCardBadge
52
- v-else-if="dataservice.access_type === 'open_with_account'"
53
- :icon="RiPassValidLine"
54
- tone="yellow"
55
- >
56
- {{ t('Ouvert avec un compte') }}
57
- </ObjectCardBadge>
32
+ <DataserviceBadge
33
+ v-if="getDataserviceStatus(dataservice) !== 'public'"
34
+ :dataservice
35
+ />
36
+ <AccessTypeBadge
37
+ v-else
38
+ :access-type="dataservice.access_type"
39
+ />
58
40
  </template>
59
41
 
60
42
  <ObjectCardOwner
@@ -108,23 +90,22 @@
108
90
  import { computed } from 'vue'
109
91
  import type { RouteLocationRaw } from 'vue-router'
110
92
  import {
111
- RiArchiveLine,
112
93
  RiEyeLine,
113
- RiLockLine,
114
- RiPassValidLine,
115
94
  RiSparklingLine,
116
95
  RiStarLine,
117
96
  RiTerminalLine,
118
97
  } from '@remixicon/vue'
119
98
  import { useComponentsConfig } from '../config'
99
+ import { getDataserviceStatus } from '../functions/objectStatus'
120
100
  import type { Dataservice } from '../types/dataservices'
121
101
  import type { TitleTag } from '../types/ui'
122
102
  import { useTranslation } from '../composables/useTranslation'
103
+ import AccessTypeBadge from './AccessTypeBadge.vue'
104
+ import DataserviceBadge from './DataserviceBadge.vue'
123
105
  import OrganizationLogo from './OrganizationLogo.vue'
124
106
  import Avatar from './Avatar.vue'
125
107
  import Placeholder from './Placeholder.vue'
126
108
  import ObjectCard from './ObjectCard.vue'
127
- import ObjectCardBadge from './ObjectCardBadge.vue'
128
109
  import ObjectCardMeta from './ObjectCardMeta.vue'
129
110
  import ObjectCardMetric from './ObjectCardMetric.vue'
130
111
  import ObjectCardMetrics from './ObjectCardMetrics.vue'
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <ObjectStatusBadge
3
+ :status="getDatasetStatus(dataset)"
4
+ :size
5
+ />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { getDatasetStatus } from '../functions/objectStatus'
10
+ import type { Dataset, DatasetV2, DatasetV2WithFullObject } from '../types/datasets'
11
+ import ObjectStatusBadge from './ObjectStatusBadge.vue'
12
+
13
+ defineProps<{
14
+ dataset: Dataset | DatasetV2 | DatasetV2WithFullObject
15
+ size?: 'xs' | 'sm'
16
+ }>()
17
+ </script>
@@ -29,21 +29,17 @@
29
29
  >{{ dataset.acronym }}</small>
30
30
  </template>
31
31
  <template
32
- v-if="dataset.private || dataset.archived"
32
+ v-if="getDatasetStatus(dataset) !== 'public' || dataset.access_type !== 'open'"
33
33
  #badge
34
34
  >
35
- <ObjectCardBadge
36
- v-if="dataset.private"
37
- :icon="RiLockLine"
38
- >
39
- {{ t('Brouillon') }}
40
- </ObjectCardBadge>
41
- <ObjectCardBadge
35
+ <DatasetBadge
36
+ v-if="getDatasetStatus(dataset) !== 'public'"
37
+ :dataset
38
+ />
39
+ <AccessTypeBadge
42
40
  v-else
43
- :icon="RiArchiveLine"
44
- >
45
- {{ t('Archivé') }}
46
- </ObjectCardBadge>
41
+ :access-type="dataset.access_type"
42
+ />
47
43
  </template>
48
44
 
49
45
  <ObjectCardOwner
@@ -107,24 +103,24 @@
107
103
  <script setup lang="ts">
108
104
  import type { RouteLocationRaw } from 'vue-router'
109
105
  import {
110
- RiArchiveLine,
111
106
  RiDatabase2Line,
112
107
  RiDownloadLine,
113
108
  RiEyeLine,
114
109
  RiLineChartLine,
115
- RiLockLine,
116
110
  RiStarLine,
117
111
  } from '@remixicon/vue'
118
112
  import type { Dataset, DatasetV2 } from '../types/datasets'
119
113
  import type { TitleTag } from '../types/ui'
120
114
  import { getDescriptionShort } from '../functions/description'
115
+ import { getDatasetStatus } from '../functions/objectStatus'
121
116
  import { useTranslation } from '../composables/useTranslation'
117
+ import AccessTypeBadge from './AccessTypeBadge.vue'
118
+ import DatasetBadge from './DatasetBadge.vue'
122
119
  import DatasetQualityInline from './DatasetQualityInline.vue'
123
120
  import Avatar from './Avatar.vue'
124
121
  import Placeholder from './Placeholder.vue'
125
122
  import OrganizationLogo from './OrganizationLogo.vue'
126
123
  import ObjectCard from './ObjectCard.vue'
127
- import ObjectCardBadge from './ObjectCardBadge.vue'
128
124
  import ObjectCardMeta from './ObjectCardMeta.vue'
129
125
  import ObjectCardMetric from './ObjectCardMetric.vue'
130
126
  import ObjectCardMetrics from './ObjectCardMetrics.vue'
@@ -7,16 +7,13 @@
7
7
  <div v-if="dataset.tags && dataset.tags.length">
8
8
  <DescriptionListTerm>{{ t('Mots-clés') }}</DescriptionListTerm>
9
9
  <DescriptionListDetails class="flex flex-wrap gap-2 items-start">
10
- <AppLink
10
+ <Tag
11
11
  v-for="tag in dataset.tags"
12
12
  :key="tag"
13
- class="fr-raw-link"
14
13
  :to="getTagUrl(tag)"
15
14
  >
16
- <Tag type="secondary">
17
- {{ tag }}
18
- </Tag>
19
- </AppLink>
15
+ {{ tag }}
16
+ </Tag>
20
17
  </DescriptionListDetails>
21
18
  </div>
22
19
  <div>
@@ -51,7 +48,6 @@ import type { DatasetV2WithFullObject } from '../../types/datasets'
51
48
  import DescriptionList from '../DescriptionList.vue'
52
49
  import DescriptionListTerm from '../DescriptionListTerm.vue'
53
50
  import DescriptionListDetails from '../DescriptionListDetails.vue'
54
- import AppLink from '../AppLink.vue'
55
51
  import CopyButton from '../CopyButton.vue'
56
52
  import LicenseBadge from '../LicenseBadge.vue'
57
53
  import Tag from '../Tag.vue'
@@ -14,10 +14,7 @@
14
14
  >
15
15
  <p class="text-sm mb-0">
16
16
  {{ t('Les fichiers du jeu de données suivent le schéma :') }}
17
- <Tag
18
- type="secondary"
19
- :icon="RiCheckboxCircleLine"
20
- >
17
+ <Tag :icon="RiCheckboxCircleLine">
21
18
  {{ schema.name || schema.url }}
22
19
  </Tag>
23
20
  </p>
@@ -1,27 +1,16 @@
1
1
  <template>
2
- <component
3
- :is="url ? AppLink : 'span'"
2
+ <Tag
4
3
  :to="url"
5
- class="text-xs leading-5 px-2 py-0.5 rounded-full uppercase inline-flex items-center"
6
- :class="{
7
- 'bg-none bg-datagouv hover:bg-datagouv-dark text-white gap-1': url,
8
- 'bg-gray-lower gap-0.5': !url,
9
- }"
4
+ :icon="img"
10
5
  >
11
- <img
12
- v-if="img"
13
- :src="img"
14
- alt=""
15
- :class="{ 'bg-white rounded-full': url }"
16
- >
17
6
  {{ badge.label }}
18
- </component>
7
+ </Tag>
19
8
  </template>
20
9
 
21
10
  <script setup lang="ts">
22
11
  import { computedAsync } from '@vueuse/core'
23
12
  import type { RouteLocationRaw } from 'vue-router'
24
- import AppLink from './AppLink.vue'
13
+ import Tag from './Tag.vue'
25
14
  import type { TranslatedBadge } from '../types/badges'
26
15
 
27
16
  const props = defineProps<{
@@ -83,7 +83,6 @@ export type SelectGroupProps = {
83
83
  isValid?: boolean
84
84
  label: string
85
85
  hideLabel?: boolean
86
- modelValue?: string | boolean | null
87
86
  options: Array<SelectOption>
88
87
  required?: boolean
89
88
  validText?: string
@@ -98,7 +97,6 @@ const props = withDefaults(defineProps<SelectGroupProps>(), {
98
97
  hasError: false,
99
98
  hintText: '',
100
99
  isValid: false,
101
- modelValue: undefined,
102
100
  required: false,
103
101
  validText: '',
104
102
  hideLabel: false,
@@ -1,22 +1,17 @@
1
1
  <template>
2
- <AppLink
3
- v-if="license && license.url"
4
- :to="license.url"
5
- class="px-1 py-[2px] font-mono bg-gray-some text-gray-medium rounded"
2
+ <Badge
3
+ v-if="license"
4
+ :to="license.url || null"
5
+ class="font-mono"
6
+ :title="license.title"
6
7
  >
7
8
  {{ license.title }}
8
- </AppLink>
9
- <span
10
- v-else-if="license"
11
- class="px-1 py-[2px] font-mono bg-gray-some text-gray-medium rounded"
12
- >
13
- {{ license.title }}
14
- </span>
9
+ </Badge>
15
10
  </template>
16
11
 
17
12
  <script setup lang="ts">
18
13
  import type { License } from '../types/licenses'
19
- import AppLink from './AppLink.vue'
14
+ import Badge from './Badge.vue'
20
15
 
21
16
  defineProps<{
22
17
  license: License
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <Badge
3
+ :size
4
+ :tone="display.tone"
5
+ :icon="size === 'sm' ? display.icon : null"
6
+ :medium="size === 'sm'"
7
+ >
8
+ {{ display.label }}
9
+ </Badge>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { RiArchiveLine, RiDeleteBinLine, RiDraftLine } from '@remixicon/vue'
14
+ import { computed, type Component } from 'vue'
15
+ import { useTranslation } from '../composables/useTranslation'
16
+ import type { ObjectStatus } from '../functions/objectStatus'
17
+ import { throwOnNever } from '../functions/never'
18
+ import type { BadgeTone } from '../types/ui'
19
+ import Badge from './Badge.vue'
20
+
21
+ // Compact table cells (xs) show the bare status, cards and pages (sm) a medium label with its icon
22
+ const props = withDefaults(defineProps<{
23
+ status: ObjectStatus
24
+ size?: 'xs' | 'sm'
25
+ }>(), {
26
+ size: 'sm',
27
+ })
28
+
29
+ const { t } = useTranslation()
30
+
31
+ type StatusDisplay = { label: string, tone: BadgeTone, icon: Component | null }
32
+
33
+ const display = computed<StatusDisplay>(() => {
34
+ switch (props.status) {
35
+ case 'deleted':
36
+ return { label: t('Supprimé'), tone: 'danger', icon: RiDeleteBinLine }
37
+ case 'archived':
38
+ return { label: t('Archivé'), tone: 'warning', icon: RiArchiveLine }
39
+ case 'private':
40
+ return { label: t('Brouillon'), tone: 'neutral', icon: RiDraftLine }
41
+ case 'public':
42
+ return { label: t('Public'), tone: 'primary', icon: null }
43
+ default:
44
+ return throwOnNever(props.status, 'Unknown object status')
45
+ }
46
+ })
47
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <Badge
3
+ v-if="organization.deleted"
4
+ tone="danger"
5
+ :icon="RiDeleteBinLine"
6
+ medium
7
+ >
8
+ {{ t('Supprimée') }}
9
+ </Badge>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { RiDeleteBinLine } from '@remixicon/vue'
14
+ import { useTranslation } from '../composables/useTranslation'
15
+ import type { Organization } from '../types/organizations'
16
+ import Badge from './Badge.vue'
17
+
18
+ // An active organization has no status worth showing: only a deleted one gets a badge
19
+ defineProps<{
20
+ organization: Organization
21
+ }>()
22
+
23
+ const { t } = useTranslation()
24
+ </script>