@datagouv/components-next 0.0.8 → 0.0.10

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 (103) hide show
  1. package/README.md +34 -14
  2. package/assets/json/vector.json +2377 -0
  3. package/assets/main.css +3 -0
  4. package/assets/swagger-themes/newspaper.css +1669 -0
  5. package/assets/tailwind.config.js +1 -1
  6. package/dist/JsonPreview.client-DFSq3qMS.js +92 -0
  7. package/dist/MapContainer.client-CCHOsGLk.js +78314 -0
  8. package/dist/PdfPreview.client-Ce-Rk3ui.js +112 -0
  9. package/dist/Pmtiles.client-pBRpsEs7.js +22377 -0
  10. package/dist/Swagger.client-CfS91EWS.js +4 -0
  11. package/dist/XmlPreview.client-D62Apole.js +84 -0
  12. package/dist/components-next.css +52 -1
  13. package/dist/components-next.js +42 -41
  14. package/dist/components.css +1 -1
  15. package/dist/main-CRrqrPkO.js +105745 -0
  16. package/dist/pdf-vue3-D9uzcuC5.js +273 -0
  17. package/dist/pdf.min-f72cfa08-DAetWL3M.js +9501 -0
  18. package/dist/{text-clamp.esm-DurZFOvT.js → text-clamp.esm-CmCeJwgZ.js} +1 -1
  19. package/dist/vue3-json-viewer-B8azJ68d.js +1089 -0
  20. package/dist/vue3-xml-viewer.common-CIro0ncJ.js +5430 -0
  21. package/package.json +10 -8
  22. package/src/components/AvatarWithName.vue +6 -2
  23. package/src/components/BannerAction.vue +1 -1
  24. package/src/components/BrandedButton.vue +13 -8
  25. package/src/components/CopyButton.vue +7 -7
  26. package/src/components/DataserviceCard.vue +54 -23
  27. package/src/components/DatasetCard.vue +36 -24
  28. package/src/components/DatasetInformationPanel.vue +19 -18
  29. package/src/components/DatasetQuality.vue +21 -18
  30. package/src/components/DatasetQualityInline.vue +1 -1
  31. package/src/components/DatasetQualityItem.vue +3 -3
  32. package/src/components/DatasetQualityItemWarning.vue +2 -2
  33. package/src/components/DatasetQualityScore.vue +2 -2
  34. package/src/components/DatasetQualityTooltipContent.vue +29 -29
  35. package/src/components/DescriptionDetails.vue +2 -2
  36. package/src/components/ExtraAccordion.vue +10 -7
  37. package/src/components/OrganizationCard.vue +9 -4
  38. package/src/components/OrganizationNameWithCertificate.vue +25 -11
  39. package/src/components/Pagination.vue +26 -15
  40. package/src/components/ReadMore.vue +2 -2
  41. package/src/components/ResourceAccordion/DataStructure.vue +2 -2
  42. package/src/components/ResourceAccordion/EditButton.vue +10 -6
  43. package/src/components/ResourceAccordion/JsonPreview.client.vue +153 -0
  44. package/src/components/ResourceAccordion/MapContainer.client.vue +137 -0
  45. package/src/components/ResourceAccordion/Metadata.vue +33 -54
  46. package/src/components/ResourceAccordion/PdfPreview.client.vue +189 -0
  47. package/src/components/ResourceAccordion/Pmtiles.client.vue +166 -0
  48. package/src/components/ResourceAccordion/Preview.vue +39 -37
  49. package/src/components/ResourceAccordion/ResourceAccordion.vue +141 -63
  50. package/src/components/ResourceAccordion/ResourceIcon.vue +7 -1
  51. package/src/components/ResourceAccordion/SchemaBadge.vue +26 -26
  52. package/src/components/ResourceAccordion/{Swagger.vue → Swagger.client.vue} +1 -1
  53. package/src/components/ResourceAccordion/XmlPreview.client.vue +143 -0
  54. package/src/components/ReuseCard.vue +10 -7
  55. package/src/components/ReuseDetails.vue +3 -3
  56. package/src/components/SimpleBanner.vue +7 -4
  57. package/src/components/SmallChart.vue +23 -9
  58. package/src/components/StatBox.vue +92 -10
  59. package/src/config.ts +6 -2
  60. package/src/functions/api.ts +18 -18
  61. package/src/functions/dates.ts +81 -74
  62. package/src/functions/helpers.ts +5 -4
  63. package/src/functions/organizations.ts +5 -5
  64. package/src/functions/resources.ts +34 -5
  65. package/src/functions/schemas.ts +4 -3
  66. package/src/functions/tabularApi.ts +1 -1
  67. package/src/main.ts +10 -11
  68. package/src/types/badges.ts +3 -3
  69. package/src/types/contact_point.ts +5 -5
  70. package/src/types/dataservices.ts +16 -2
  71. package/src/types/datasets.ts +20 -2
  72. package/src/types/frequency.ts +5 -5
  73. package/src/types/granularity.ts +12 -4
  74. package/src/types/harvest.ts +2 -2
  75. package/src/types/licenses.ts +8 -8
  76. package/src/types/organizations.ts +6 -0
  77. package/src/types/resources.ts +3 -3
  78. package/src/types/reuses.ts +3 -1
  79. package/src/types/site.ts +8 -0
  80. package/src/types/ui.ts +2 -2
  81. package/src/types/users.ts +24 -8
  82. package/src/types/vue3-xml-viewer.d.ts +10 -0
  83. package/dist/Swagger-DjysB-OI.js +0 -67851
  84. package/dist/en-DCRve7vN.js +0 -613
  85. package/dist/fr-DCOnbL-p.js +0 -613
  86. package/dist/locales/de.js +0 -155
  87. package/dist/locales/en.js +0 -155
  88. package/dist/locales/es.js +0 -155
  89. package/dist/locales/fr.js +0 -155
  90. package/dist/locales/it.js +0 -155
  91. package/dist/locales/pt.js +0 -155
  92. package/dist/locales/sr.js +0 -155
  93. package/dist/main-CPW2vNLE.js +0 -32008
  94. package/src/components/DescriptionList/DescriptionDetails.stories.ts +0 -43
  95. package/src/components/DescriptionList/DescriptionList.stories.ts +0 -47
  96. package/src/components/DescriptionList/DescriptionTerm.stories.ts +0 -28
  97. package/src/locales/de.json +0 -154
  98. package/src/locales/en.json +0 -154
  99. package/src/locales/es.json +0 -154
  100. package/src/locales/fr.json +0 -154
  101. package/src/locales/it.json +0 -154
  102. package/src/locales/pt.json +0 -154
  103. package/src/locales/sr.json +0 -154
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @datagouv/components
2
2
 
3
- In this document, "the user" is the application using `@datagouv/components` (for example: `cdata` or `udata-front-kit`).
3
+ In this document, "the user" is the application using `@datagouv/components` (for example: `cdata` or `udata-front-kit`). For general project setup and development, see the [main project README](../README.md).
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ### Config
8
8
 
9
- `@datagouv/components` provides a Vue plugin to load the configuration.
9
+ `@datagouv/components` provides a [Vue](https://vuejs.org/) plugin to load the configuration.
10
10
 
11
11
  ```ts
12
12
  import { datagouv } from '@datagouv/components-next'
@@ -21,10 +21,11 @@ app.use(datagouv, {
21
21
 
22
22
  ### Special functions and components (only for Nuxt)
23
23
 
24
- Nuxt is a special environnement (both server and browser) and require some special functions and components to work.
24
+ Nuxt is a special environment (both server and browser) and requires some special functions and components to work.
25
25
 
26
26
  ```ts
27
- import { NuxtLinkLocale, TextClamp } from '#components'
27
+ import { TextClamp } from '#components'
28
+ import CdataLink from './components/CdataLink.vue'
28
29
  import { datagouv, type UseFetchFunction } from '@datagouv/components-next'
29
30
 
30
31
  const runtimeConfig = useRuntimeConfig()
@@ -49,20 +50,20 @@ app.vueApp.use(datagouv, {
49
50
  // Provide the component to create links inside the application
50
51
  // This component will receive the raw link (without i18n prefix)
51
52
  // and needs to add it.
52
- appLink: NuxtLinkLocale,
53
+ appLink: CdataLink,
53
54
  })
54
55
  ```
55
56
 
56
57
  ### CSS
57
58
 
58
- `@datagouv/components` is using TailwindCSS and some DSFR right now. The user needs to provide the correct version of the DSFR. Concerning TailwindCSS, there is two modes:
59
+ `@datagouv/components` is using [TailwindCSS](https://tailwindcss.com/docs) and some [DSFR](https://www.systeme-de-design.gouv.fr/) right now. The user needs to provide the correct version of the DSFR. Concerning TailwindCSS, there are two modes:
59
60
 
60
61
  1. If the user is using TailwindCSS, it can import a full TailwindCSS config with `@import "@datagouv/components-next/assets/main.css";`, then build the CSS via TailwindCSS CLI or Vite plugin.
61
- 2. If the user is not using TailwindCSS, it can import an already built CSS file with `@import '@datagouv/components-next/dist/components.css';`. Note @dev, this file should be built before publishing the package to NPM with `npm run css`.
62
+ 2. If the user is not using TailwindCSS, it can import an already built CSS file with `@import '@datagouv/components-next/dist/components.css';`. Note @dev, this file should be built before publishing the package to NPM with `npm run css`. For more details on the [technology stack](../README.md#-technology-stack), see the main README.
62
63
 
63
64
  ### I18n
64
65
 
65
- `@datagouv/components` is using `vue-i18n` to provide internationalisation. As always, there is two modes:
66
+ `@datagouv/components` is using [`vue-i18n`](https://vue-i18n.intlify.dev/) to provide internationalisation. As always, there are two modes:
66
67
 
67
68
  1. If the user is using Nuxt, it can simply add the locales files in the `nuxt.config.ts`
68
69
 
@@ -76,11 +77,11 @@ app.vueApp.use(datagouv, {
76
77
 
77
78
  Nuxt is responsible for building the JSON file to the correct `vue-i18n` JS format.
78
79
 
79
- 2. If the user is not using Nuxt, it should provide the i18n object to the `datagouv` Vue plugin. The plugin will then merge the already built messages's files. Note @dev, the messages's files should be built with `npm run i18n` before publishing the package to NPM.
80
+ 2. If the user is not using Nuxt, it should provide the i18n object to the `datagouv` Vue plugin. The plugin will then merge the already built messages's files.
80
81
 
81
- ### `Supense`
82
+ ### `Suspense`
82
83
 
83
- To work with Nuxt, some components are doing HTTP requests during the `setup` function (Nuxt can then do SSR for these requests: doing these requests server-side). These components need to be wrapped in a [`<Suspense>`](https://vuejs.org/guide/built-ins/suspense) wrapper (you can even provide a `#fallback`). You can either wrap individual components inside `<Suspense>` or wrap you're entire application/layout in `<Suspense>`
84
+ To work with [Nuxt](https://nuxt.com/), some components are doing HTTP requests during the `setup` function (Nuxt can then do SSR for these requests: doing these requests server-side). These components need to be wrapped in a [`<Suspense>`](https://vuejs.org/guide/built-ins/suspense) wrapper (you can even provide a `#fallback`). You can either wrap individual components inside `<Suspense>` or wrap your entire application/layout in `<Suspense>`
84
85
 
85
86
  ```html
86
87
  <Suspense>
@@ -90,6 +91,19 @@ To work with Nuxt, some components are doing HTTP requests during the `setup` fu
90
91
 
91
92
  ## Development
92
93
 
94
+ For general development guidelines and contributing, see the [contributing section](../README.md#-contributing) in the main README.
95
+
96
+ ### Code Linting and Formatting
97
+
98
+ This component library uses both ESLint and Prettier for code quality and formatting:
99
+
100
+ ```bash
101
+ npm run lint # Lint and auto-fix ESLint issues
102
+ npm run format # Format code with Prettier
103
+ ```
104
+
105
+ **Note:** Make sure to run both commands before submitting contributions to ensure consistent code style.
106
+
93
107
  ### Config
94
108
 
95
109
  You can use the config with the composable `useComponentsConfig()`.
@@ -103,7 +117,7 @@ const config = useComponentsConfig()
103
117
  ### Special functions and components (only for Nuxt)
104
118
 
105
119
  > [!WARNING]
106
- > In `@datagouv/components` there is a few functions and components we cannot use directly:
120
+ > In `@datagouv/components` there are a few functions and components we cannot use directly:
107
121
  > - `TextClamp` component
108
122
  > - `useFetch` Nuxt function
109
123
 
@@ -145,6 +159,12 @@ const config = useComponentsConfig()
145
159
 
146
160
  #### Links
147
161
 
148
- To do links in the application you can use the `<AppLink>` component. No sure why it's required. Maybe we could always use a `<RouterLink>` from `vue-router` since every users is using `vue-router`? I think it's useful to add lang prefix to links but it's not done yet? Need testing.
162
+ To do links in the application you can use the `<AppLink>` component. Not sure why it's required. Maybe we could always use a `<RouterLink>` from [`vue-router`](https://router.vuejs.org/) since every user is using `vue-router`? I think it's useful to add lang prefix to links but it's not done yet? Need testing.
163
+
164
+ Maybe this component shouldn't be exposed too, because I don't know why a user should use this instead of their own component (`<RouterLink>` or `<CdataLink>`…)
165
+
166
+ ## 📄 License
167
+
168
+ This component library is licensed under the **MIT License**, which is the same as the main project. This allows for permissive usage of the components in other projects.
149
169
 
150
- Maybe this component shouldn't be exposed too, because I don't know why a user should use this instead of his own component (`<RouterLink>` or `NuxtLinkLocale`…)
170
+ For more details, see the [LICENSE](../LICENSE) file in the main project directory.