@datagouv/components-next 0.0.32 → 0.1.0

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 (85) hide show
  1. package/README.md +5 -15
  2. package/assets/labels/hvd.svg +15 -0
  3. package/assets/labels/inspire.svg +20 -0
  4. package/assets/labels/sl.svg +5 -0
  5. package/assets/labels/spd.svg +5 -0
  6. package/assets/labels/sr.svg +5 -0
  7. package/dist/JsonPreview.client-NQ9byxF5.js +92 -0
  8. package/dist/{MapContainer.client-Dhfz-YU8.js → MapContainer.client-D7Y0OXMU.js} +17587 -6826
  9. package/dist/{PdfPreview.client--W0FK7CN.js → PdfPreview.client-DU6FbUh0.js} +47 -48
  10. package/dist/{Pmtiles.client-B6vRTwrm.js → Pmtiles.client-DCOxft6M.js} +7609 -7503
  11. package/dist/Swagger.client-DTHhEAFT.js +4 -0
  12. package/dist/XmlPreview.client-BEOCeCP8.js +84 -0
  13. package/dist/components-next.css +6 -6
  14. package/dist/components-next.js +95 -80
  15. package/dist/components.css +2 -2
  16. package/dist/en-CuSmdvir.js +30 -0
  17. package/dist/hvd-DYeke1vM.js +4 -0
  18. package/dist/inspire-BLXeJvob.js +4 -0
  19. package/dist/{main-yWiuApVL.js → main-DFEQrdg5.js} +53395 -55984
  20. package/dist/{pdf-vue3-Dm2ZCc3P.js → pdf-vue3-IkJO65RH.js} +2 -2
  21. package/dist/{pdf.min-f72cfa08-DAetWL3M.js → pdf.min-f72cfa08-CdgJTooZ.js} +78 -78
  22. package/dist/sl-VR8Tb1_u.js +4 -0
  23. package/dist/spd-BJ-Omhgt.js +4 -0
  24. package/dist/sr-DjSF-8xW.js +4 -0
  25. package/dist/{text-clamp.esm-Mb7Qdtu9.js → text-clamp.esm-B5kW_XMt.js} +54 -55
  26. package/dist/{vue3-json-viewer-B1fiyuLU.js → vue3-json-viewer-BXwup7nO.js} +88 -93
  27. package/dist/{vue3-xml-viewer.common-1QyofKqS.js → vue3-xml-viewer.common-RC76oYFu.js} +54 -54
  28. package/package.json +12 -11
  29. package/src/components/ActivityList/ActivityList.vue +159 -0
  30. package/src/components/ActivityList/UserActivityList.vue +30 -0
  31. package/src/components/AppLink.vue +3 -3
  32. package/src/components/Avatar.vue +1 -0
  33. package/src/components/DataserviceCard.vue +3 -3
  34. package/src/components/DatasetCard.vue +19 -18
  35. package/src/components/DatasetInformationPanel.vue +16 -16
  36. package/src/components/DatasetLabelTag.vue +40 -0
  37. package/src/components/DatasetQuality.vue +13 -10
  38. package/src/components/DatasetQualityInline.vue +5 -2
  39. package/src/components/DatasetQualityScore.vue +3 -3
  40. package/src/components/DatasetQualityTooltipContent.vue +2 -2
  41. package/src/components/DateRangeDetails.vue +7 -3
  42. package/src/components/ExtraAccordion.vue +3 -1
  43. package/src/components/OrganizationNameWithCertificate.vue +2 -2
  44. package/src/components/PaddedContainer.vue +28 -0
  45. package/src/components/Pagination.vue +2 -2
  46. package/src/components/Placeholder.vue +1 -1
  47. package/src/components/ReadMore.vue +17 -17
  48. package/src/components/ResourceAccordion/DataStructure.vue +8 -3
  49. package/src/components/ResourceAccordion/EditButton.vue +2 -2
  50. package/src/components/ResourceAccordion/JsonPreview.client.vue +7 -5
  51. package/src/components/ResourceAccordion/MapContainer.client.vue +2 -2
  52. package/src/components/ResourceAccordion/Metadata.vue +10 -10
  53. package/src/components/ResourceAccordion/PdfPreview.client.vue +7 -5
  54. package/src/components/ResourceAccordion/Pmtiles.client.vue +2 -2
  55. package/src/components/ResourceAccordion/Preview.vue +2 -2
  56. package/src/components/ResourceAccordion/ResourceAccordion.vue +23 -15
  57. package/src/components/ResourceAccordion/SchemaBadge.vue +4 -4
  58. package/src/components/ResourceAccordion/XmlPreview.client.vue +7 -5
  59. package/src/components/ReuseCard.vue +3 -3
  60. package/src/components/ReuseDetails.vue +2 -2
  61. package/src/components/SmallChart.vue +33 -30
  62. package/src/components/StatBox.vue +6 -6
  63. package/src/components/Toggletip.vue +0 -1
  64. package/src/components/TranslationT.vue +51 -0
  65. package/src/composables/useTranslation.ts +169 -0
  66. package/src/functions/activities.ts +36 -0
  67. package/src/functions/api.ts +4 -4
  68. package/src/functions/datasets.ts +28 -0
  69. package/src/functions/dates.ts +4 -4
  70. package/src/functions/helpers.ts +3 -3
  71. package/src/functions/organizations.ts +2 -2
  72. package/src/functions/pagination.ts +9 -0
  73. package/src/functions/resources.ts +2 -2
  74. package/src/functions/reuses.ts +3 -3
  75. package/src/main.ts +24 -20
  76. package/src/types/activity.ts +24 -0
  77. package/src/types/api.ts +8 -0
  78. package/src/types/badges.ts +4 -0
  79. package/src/types/dataservices.ts +6 -8
  80. package/src/types/datasets.ts +2 -1
  81. package/src/types/site.ts +1 -0
  82. package/src/types/topics.ts +17 -2
  83. package/dist/JsonPreview.client-BRhCOHlE.js +0 -93
  84. package/dist/Swagger.client-ch5H8aT2.js +0 -4
  85. package/dist/XmlPreview.client-BcbnRWAp.js +0 -85
@@ -0,0 +1,8 @@
1
+ export type PaginatedArray<T> = {
2
+ data: Array<T>
3
+ next_page: string | null
4
+ page: number
5
+ page_size: number
6
+ previous_page: string | null
7
+ total: number
8
+ }
@@ -2,4 +2,8 @@ export type Badge = {
2
2
  kind: string
3
3
  }
4
4
 
5
+ export type TranslatedBadge = Badge & {
6
+ label: string
7
+ }
8
+
5
9
  export type Badges = Array<Badge>
@@ -43,14 +43,12 @@ export type Dataservice = Owned & {
43
43
  base_api_url: string | null
44
44
  contact_points: Array<ContactPoint>
45
45
  created_at: string
46
- datasets: Array<{
47
- class: string
48
- id: string
49
- acronym: string
50
- page: string
51
- title: string
52
- uri: string
53
- }>
46
+ datasets: {
47
+ href: string
48
+ rel: 'subsection'
49
+ total: number
50
+ type: 'GET'
51
+ }
54
52
  deleted_at: string | null
55
53
  description: string
56
54
  featured: boolean
@@ -27,6 +27,7 @@ export type BaseDataset = Owned & {
27
27
  acronym: string
28
28
  archived: boolean
29
29
  description: string
30
+ description_short: string
30
31
  tags: Array<string> | null
31
32
  license: string
32
33
  frequency: string
@@ -88,7 +89,7 @@ export type DatasetV2 = Owned & Omit<Dataset, 'resources' | 'community_resources
88
89
  community_resources: Rel
89
90
  }
90
91
 
91
- export type DatasetV2WithFullObject = Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
92
+ export type DatasetV2WithFullObject = Owned & Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
92
93
  license: License
93
94
  frequency: Frequency
94
95
  spatial: {
package/src/types/site.ts CHANGED
@@ -4,6 +4,7 @@ export type Site = {
4
4
  datasets_page: string | null
5
5
  reuses_page: string | null
6
6
  dataservices_page: string | null
7
+ version: string
7
8
  metrics: {
8
9
  'dataservices': number
9
10
  'datasets': number
@@ -1,14 +1,29 @@
1
1
  import type { Rel } from './datasets'
2
2
  import type { Owned } from './owned'
3
3
 
4
+ export type TopicElementClass = 'Dataset' | 'Reuse'
5
+
6
+ export type TopicElementRel = {
7
+ id: string
8
+ class: TopicElementClass
9
+ }
10
+
11
+ export type TopicElement = {
12
+ id: string
13
+ title?: string
14
+ description?: string
15
+ tags: Array<string>
16
+ extras: Record<string, unknown>
17
+ element: TopicElementRel
18
+ }
19
+
4
20
  export type TopicV2 = Owned & {
5
21
  id: string
6
22
  name: string
7
23
  slug: string
8
24
  description: string
9
25
  tags: Array<string>
10
- datasets: Rel
11
- reuses: Rel
26
+ elements: Rel
12
27
  featured: boolean
13
28
  private: boolean
14
29
  created_at: string
@@ -1,93 +0,0 @@
1
- import { defineComponent as b, defineAsyncComponent as C, ref as o, computed as x, onMounted as S, createElementBlock as p, openBlock as n, createBlock as f, createCommentVNode as N, createVNode as a, unref as u, toDisplayString as i, withCtx as d, createElementVNode as h } from "vue";
2
- import { d as P, a as m, F as v } from "./main-yWiuApVL.js";
3
- const T = { class: "fr-text--xs" }, $ = { key: 0 }, E = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, O = /* @__PURE__ */ b({
7
- __name: "JsonPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = C(
13
- () => import("./vue3-json-viewer-B1fiyuLU.js").then((e) => (Promise.resolve({ }), e.JsonViewer))
14
- ), s = k, g = P(), l = o(null), c = o(!1), r = o(null), y = o(!1), w = x(() => {
15
- var t;
16
- if (s.resource.filesize)
17
- return s.resource.filesize;
18
- const e = (t = s.resource.extras) == null ? void 0 : t["analysis:content-length"];
19
- return e && typeof e == "number" ? e : null;
20
- }), J = x(() => {
21
- const e = w.value;
22
- if (!e || !g.maxJsonPreviewCharSize)
23
- return !1;
24
- const t = g.maxJsonPreviewCharSize;
25
- return e <= t;
26
- }), _ = async () => {
27
- if (!J.value) {
28
- y.value = !0;
29
- return;
30
- }
31
- c.value = !0, r.value = null;
32
- try {
33
- const e = await fetch(s.resource.url);
34
- if (!e.ok)
35
- throw new Error(`HTTP error! status: ${e.status}`);
36
- const t = await e.json();
37
- l.value = t;
38
- } catch (e) {
39
- console.error("Error loading JSON:", e), e instanceof TypeError ? r.value = "network" : r.value = "generic", l.value = null;
40
- } finally {
41
- c.value = !1;
42
- }
43
- };
44
- return S(() => {
45
- _();
46
- }), (e, t) => (n(), p("div", T, [
47
- l.value ? (n(), p("div", $, [
48
- a(u(z), {
49
- value: l.value,
50
- boxed: "",
51
- sort: "",
52
- theme: "light",
53
- "max-depth": 3,
54
- "expand-depth": 2,
55
- "indent-width": 2
56
- }, null, 8, ["value"])
57
- ])) : c.value ? (n(), p("div", E, i(e.$t("Chargement de l'aperçu JSON...")), 1)) : y.value ? (n(), f(m, {
58
- key: 2,
59
- type: "warning",
60
- class: "flex items-center space-x-2"
61
- }, {
62
- default: d(() => [
63
- a(u(v), { class: "shink-0 size-6" }),
64
- h("span", null, i(w.value ? e.$t("Fichier JSON trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : e.$t("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
65
- ]),
66
- _: 1
67
- })) : r.value === "network" ? (n(), f(m, {
68
- key: 3,
69
- type: "warning",
70
- class: "flex items-center space-x-2"
71
- }, {
72
- default: d(() => [
73
- a(u(v), { class: "shink-0 size-6" }),
74
- h("span", null, i(e.$t("Ce fichier JSON ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
75
- ]),
76
- _: 1
77
- })) : r.value ? (n(), f(m, {
78
- key: 4,
79
- type: "warning",
80
- class: "flex items-center space-x-2"
81
- }, {
82
- default: d(() => [
83
- a(u(v), { class: "shink-0 size-6" }),
84
- h("span", null, i(e.$t("Erreur lors du chargement de l'aperçu JSON.")), 1)
85
- ]),
86
- _: 1
87
- })) : N("", !0)
88
- ]));
89
- }
90
- });
91
- export {
92
- O as default
93
- };
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-yWiuApVL.js";
2
- export {
3
- f as default
4
- };
@@ -1,85 +0,0 @@
1
- import { defineComponent as C, defineAsyncComponent as b, ref as a, computed as w, onMounted as L, createElementBlock as p, openBlock as r, createBlock as f, createCommentVNode as P, createVNode as o, unref as u, toDisplayString as i, withCtx as m, createElementVNode as h } from "vue";
2
- import { d as T, a as d, F as v } from "./main-yWiuApVL.js";
3
- const $ = { class: "fr-text--xs" }, E = { key: 0 }, M = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, S = /* @__PURE__ */ C({
7
- __name: "XmlPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = b(
13
- () => import("./vue3-xml-viewer.common-1QyofKqS.js").then((e) => e.v).then((e) => e.default || e.XmlViewer)
14
- ), n = k, g = T(), s = a(null), c = a(!1), l = a(null), y = a(!1), x = w(() => {
15
- var t;
16
- if (n.resource.filesize)
17
- return n.resource.filesize;
18
- const e = (t = n.resource.extras) == null ? void 0 : t["analysis:content-length"];
19
- return e && typeof e == "number" ? e : null;
20
- }), X = w(() => {
21
- const e = x.value;
22
- if (!e || !g.maxXmlPreviewCharSize)
23
- return !1;
24
- const t = g.maxXmlPreviewCharSize;
25
- return e <= t;
26
- }), _ = async () => {
27
- if (!X.value) {
28
- y.value = !0;
29
- return;
30
- }
31
- c.value = !0, l.value = null;
32
- try {
33
- const e = await fetch(n.resource.url);
34
- if (!e.ok)
35
- throw new Error(`HTTP error! status: ${e.status}`);
36
- const t = await e.text();
37
- s.value = t;
38
- } catch (e) {
39
- console.error("Error loading XML:", e), e instanceof TypeError ? l.value = "network" : l.value = "generic", s.value = null;
40
- } finally {
41
- c.value = !1;
42
- }
43
- };
44
- return L(() => {
45
- _();
46
- }), (e, t) => (r(), p("div", $, [
47
- s.value ? (r(), p("div", E, [
48
- o(u(z), { xml: s.value }, null, 8, ["xml"])
49
- ])) : c.value ? (r(), p("div", M, i(e.$t("Chargement de l'aperçu XML...")), 1)) : y.value ? (r(), f(d, {
50
- key: 2,
51
- type: "warning",
52
- class: "flex items-center space-x-2"
53
- }, {
54
- default: m(() => [
55
- o(u(v), { class: "shink-0 size-6" }),
56
- h("span", null, i(x.value ? e.$t("Fichier XML trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : e.$t("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
57
- ]),
58
- _: 1
59
- })) : l.value === "network" ? (r(), f(d, {
60
- key: 3,
61
- type: "warning",
62
- class: "flex items-center space-x-2"
63
- }, {
64
- default: m(() => [
65
- o(u(v), { class: "shink-0 size-6" }),
66
- h("span", null, i(e.$t("Ce fichier XML ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
67
- ]),
68
- _: 1
69
- })) : l.value ? (r(), f(d, {
70
- key: 4,
71
- type: "warning",
72
- class: "flex items-center space-x-2"
73
- }, {
74
- default: m(() => [
75
- o(u(v), { class: "shink-0 size-6" }),
76
- h("span", null, i(e.$t("Erreur lors du chargement de l'aperçu XML.")), 1)
77
- ]),
78
- _: 1
79
- })) : P("", !0)
80
- ]));
81
- }
82
- });
83
- export {
84
- S as default
85
- };