@datagouv/components-next 0.0.7 → 0.0.9
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.
- package/README.md +34 -14
- package/assets/json/vector.json +2377 -0
- package/assets/main.css +3 -0
- package/assets/swagger-themes/newspaper.css +1669 -0
- package/assets/tailwind.config.js +1 -1
- package/dist/JsonPreview.client-BIz1_EiB.js +92 -0
- package/dist/MapContainer.client-ZDwr4Q_I.js +78276 -0
- package/dist/PdfPreview.client-BTTMM27i.js +112 -0
- package/dist/Pmtiles.client-4kOoUQcR.js +22377 -0
- package/dist/Swagger.client-Q7a5wb51.js +4 -0
- package/dist/XmlPreview.client-BYIIkDqf.js +84 -0
- package/dist/components-next.css +52 -1
- package/dist/components-next.js +42 -41
- package/dist/components.css +1 -1
- package/dist/main-CLUk9Jj7.js +105843 -0
- package/dist/pdf-vue3-BZh6kzke.js +273 -0
- package/dist/pdf.min-f72cfa08-DAetWL3M.js +9501 -0
- package/dist/{text-clamp.esm-DurZFOvT.js → text-clamp.esm-DP59tec5.js} +1 -1
- package/dist/vue3-json-viewer-DIQzFF6K.js +1089 -0
- package/dist/vue3-xml-viewer.common-BmKw6vER.js +5437 -0
- package/package.json +7 -5
- package/src/components/AvatarWithName.vue +6 -2
- package/src/components/BannerAction.vue +1 -1
- package/src/components/BrandedButton.vue +13 -8
- package/src/components/CopyButton.vue +7 -7
- package/src/components/DataserviceCard.vue +54 -23
- package/src/components/DatasetCard.vue +36 -24
- package/src/components/DatasetInformationPanel.vue +19 -18
- package/src/components/DatasetQuality.vue +21 -18
- package/src/components/DatasetQualityInline.vue +1 -1
- package/src/components/DatasetQualityItem.vue +3 -3
- package/src/components/DatasetQualityItemWarning.vue +2 -2
- package/src/components/DatasetQualityScore.vue +2 -2
- package/src/components/DatasetQualityTooltipContent.vue +29 -29
- package/src/components/DescriptionDetails.vue +2 -2
- package/src/components/ExtraAccordion.vue +10 -7
- package/src/components/OrganizationCard.vue +9 -4
- package/src/components/OrganizationNameWithCertificate.vue +25 -11
- package/src/components/Pagination.vue +26 -15
- package/src/components/ReadMore.vue +2 -2
- package/src/components/ResourceAccordion/DataStructure.vue +2 -2
- package/src/components/ResourceAccordion/EditButton.vue +10 -6
- package/src/components/ResourceAccordion/JsonPreview.client.vue +153 -0
- package/src/components/ResourceAccordion/MapContainer.client.vue +137 -0
- package/src/components/ResourceAccordion/Metadata.vue +33 -54
- package/src/components/ResourceAccordion/PdfPreview.client.vue +189 -0
- package/src/components/ResourceAccordion/Pmtiles.client.vue +166 -0
- package/src/components/ResourceAccordion/Preview.vue +39 -37
- package/src/components/ResourceAccordion/ResourceAccordion.vue +141 -63
- package/src/components/ResourceAccordion/ResourceIcon.vue +7 -1
- package/src/components/ResourceAccordion/SchemaBadge.vue +26 -26
- package/src/components/ResourceAccordion/{Swagger.vue → Swagger.client.vue} +1 -1
- package/src/components/ResourceAccordion/XmlPreview.client.vue +143 -0
- package/src/components/ReuseCard.vue +10 -7
- package/src/components/ReuseDetails.vue +3 -3
- package/src/components/SimpleBanner.vue +7 -4
- package/src/components/SmallChart.vue +23 -9
- package/src/components/StatBox.vue +92 -10
- package/src/config.ts +6 -2
- package/src/functions/api.ts +18 -18
- package/src/functions/dates.ts +81 -74
- package/src/functions/helpers.ts +5 -4
- package/src/functions/organizations.ts +5 -5
- package/src/functions/resources.ts +34 -5
- package/src/functions/schemas.ts +4 -3
- package/src/functions/tabularApi.ts +1 -1
- package/src/main.ts +10 -11
- package/src/types/badges.ts +3 -3
- package/src/types/contact_point.ts +5 -5
- package/src/types/dataservices.ts +16 -2
- package/src/types/datasets.ts +20 -2
- package/src/types/frequency.ts +5 -5
- package/src/types/granularity.ts +12 -4
- package/src/types/harvest.ts +2 -2
- package/src/types/licenses.ts +8 -8
- package/src/types/organizations.ts +6 -0
- package/src/types/resources.ts +3 -3
- package/src/types/reuses.ts +3 -1
- package/src/types/site.ts +8 -0
- package/src/types/ui.ts +2 -2
- package/src/types/users.ts +24 -8
- package/src/types/vue3-xml-viewer.d.ts +10 -0
- package/dist/Swagger-DjysB-OI.js +0 -67851
- package/dist/en-DCRve7vN.js +0 -613
- package/dist/fr-DCOnbL-p.js +0 -613
- package/dist/locales/de.js +0 -155
- package/dist/locales/en.js +0 -155
- package/dist/locales/es.js +0 -155
- package/dist/locales/fr.js +0 -155
- package/dist/locales/it.js +0 -155
- package/dist/locales/pt.js +0 -155
- package/dist/locales/sr.js +0 -155
- package/dist/main-CPW2vNLE.js +0 -32008
- package/src/components/DescriptionList/DescriptionDetails.stories.ts +0 -43
- package/src/components/DescriptionList/DescriptionList.stories.ts +0 -47
- package/src/components/DescriptionList/DescriptionTerm.stories.ts +0 -28
- package/src/locales/de.json +0 -154
- package/src/locales/en.json +0 -154
- package/src/locales/es.json +0 -154
- package/src/locales/fr.json +0 -154
- package/src/locales/it.json +0 -154
- package/src/locales/pt.json +0 -154
- 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
|
|
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 {
|
|
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:
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
### `
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
|
|
170
|
+
For more details, see the [LICENSE](../LICENSE) file in the main project directory.
|