@datagouv/components-next 0.0.31 → 0.0.32

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 { g as Ke } from "./main-Qu3kUOIH.js";
1
+ import { g as Ke } from "./main-yWiuApVL.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": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./src/main.ts",
@@ -154,7 +154,7 @@ import type { Granularity } from '../types/granularity'
154
154
  import type { Frequency } from '../types/frequency'
155
155
  import type { License } from '../types/licenses'
156
156
  import { useFetch } from '../functions/api'
157
- import getDatasetOEmbedHtml from '../functions/datasets'
157
+ import { getDatasetOEmbedHtml } from '../functions/datasets'
158
158
  import ExtraAccordion from './ExtraAccordion.vue'
159
159
  import CopyButton from './CopyButton.vue'
160
160
 
@@ -1,9 +1,8 @@
1
1
  <template>
2
2
  <div class="flex items-center">
3
3
  <Toggletip
4
- :button-props="{ size: '2xs', class: '-ml-2 mt-px' }"
4
+ :button-props="{ class: '-ml-2 mt-px', title: $t('Qualité des métadonnées') }"
5
5
  >
6
- {{ $t('Qualité des métadonnées:') }}
7
6
  <template #toggletip>
8
7
  <DatasetQualityTooltipContent :quality />
9
8
  </template>
@@ -2,8 +2,9 @@
2
2
  <div class="m-0 flex flex-wrap items-center text-sm text-gray-medium">
3
3
  <div class="fr-grid-row fr-grid-row--middle">
4
4
  <Toggletip
5
- :button-props="{ class: 'relative z-2' }"
5
+ :button-props="{ class: 'relative z-2 ml-0.5', title: $t('Qualité des métadonnées') }"
6
6
  >
7
+ <RiInformationLine class="size-4" />
7
8
  <template #toggletip>
8
9
  <DatasetQualityTooltipContent :quality />
9
10
  </template>
@@ -19,6 +20,7 @@
19
20
  </template>
20
21
 
21
22
  <script setup lang="ts">
23
+ import { RiInformationLine } from '@remixicon/vue'
22
24
  import type { Quality } from '../types/datasets'
23
25
  import DatasetQualityScore from './DatasetQualityScore.vue'
24
26
  import DatasetQualityTooltipContent from './DatasetQualityTooltipContent.vue'
@@ -33,10 +33,7 @@
33
33
  </DisclosureButton>
34
34
  </div>
35
35
  </header>
36
- <DisclosurePanel
37
- :id="accordionId"
38
- class="accordion-content"
39
- >
36
+ <DisclosurePanel :id="accordionId">
40
37
  <div class="pb-6 mb-6 border-bottom border-gray-default">
41
38
  <div
42
39
  class="fr-grid-row fr-grid-row--gutters fr-text--sm fr-m-0"
@@ -19,9 +19,15 @@ const props = defineProps<{
19
19
  alt?: string
20
20
  size: number
21
21
  }>()
22
- const placeholderUrl = async () => {
23
- const module = await import(`../../assets/placeholders/${props.type}.png`)
24
- return props.src ? props.src : module.default
22
+ async function placeholderUrl() {
23
+ const placeholders = import.meta.glob(`../../assets/placeholders/*.png`, {
24
+ query: '?url',
25
+ import: 'default',
26
+ })
27
+ const name = Object.keys(placeholders).find(p => p.includes(props.type)) as string
28
+ const module = placeholders[name]
29
+ const placeholder = await module()
30
+ return props.src ? props.src : placeholder as string
25
31
  }
26
32
 
27
33
  const alternativeTextForDefinedImageOnly = computed(() => props.src ? props.alt : '')
@@ -4,9 +4,10 @@
4
4
  class="inline-flex mb-0 items-baseline text-xs"
5
5
  >
6
6
  <Toggletip
7
- :button-props="{ class: 'relative z-2 -ml-3 top-1 -my-3' }"
7
+ :button-props="{ class: 'relative z-2 -ml-3 top-1 -my-3', title: $t('Schéma de données') }"
8
8
  no-margin
9
9
  >
10
+ <RiInformationLine class="size-4" />
10
11
  <template #toggletip="{ close }">
11
12
  <div class="flex justify-between border-bottom">
12
13
  <h5 class="fr-text--sm fr-my-0 fr-p-2v">{{ $t("Schéma de données") }}</h5>
@@ -94,6 +95,7 @@
94
95
  </template>
95
96
 
96
97
  <script setup lang="ts">
98
+ import { RiInformationLine } from '@remixicon/vue'
97
99
  import { computed, onMounted, ref } from 'vue'
98
100
  import { useI18n } from 'vue-i18n'
99
101
  import type { Resource } from '../../types/resources'
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <Popover
3
3
  v-slot="{ open, close }"
4
+ ref="popover"
4
5
  class="relative"
5
6
  >
6
7
  <!--
@@ -11,17 +12,13 @@
11
12
  :value="open"
12
13
  @changed="calculatePanelPosition"
13
14
  />
14
- <PopoverButton ref="button">
15
- <BrandedButton
16
- color="secondary-softer"
17
- icon-only
18
- :icon="RiInformationLine"
19
- size="xs"
20
- keep-margins-even-without-borders
21
- v-bind="buttonProps"
22
- >
23
- <slot />
24
- </BrandedButton>
15
+ <PopoverButton
16
+ v-bind="buttonProps"
17
+ class="w-8 h-8 rounded-full -outline-offset-2 inline-flex items-center justify-center bg-transparent border-transparent hover:!bg-gray-some"
18
+ >
19
+ <slot>
20
+ <RiInformationLine class="size-5" />
21
+ </slot>
25
22
  </PopoverButton>
26
23
 
27
24
  <ClientOnly>
@@ -49,7 +46,6 @@
49
46
  import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
50
47
  import { nextTick, onBeforeUnmount, onMounted, onUpdated, ref, useTemplateRef } from 'vue'
51
48
  import { RiInformationLine } from '@remixicon/vue'
52
- import BrandedButton from './BrandedButton.vue'
53
49
  import ClientOnly from './ClientOnly.vue'
54
50
  import ValueWatcher from './ValueWatcher.vue'
55
51
 
@@ -58,7 +54,7 @@ defineProps<{
58
54
  noMargin?: boolean
59
55
  }>()
60
56
 
61
- const buttonRef = useTemplateRef('button')
57
+ const popoverRef = useTemplateRef('popover')
62
58
  const panelStyle = ref({})
63
59
 
64
60
  // Since the parent of the component can have an overflow-hidden
@@ -66,17 +62,17 @@ const panelStyle = ref({})
66
62
  // We need to compute the correct position of the tooltip.
67
63
  const calculatePanelPosition = () => {
68
64
  nextTick(() => {
69
- const button = buttonRef.value?.$el || buttonRef.value
65
+ const popover = popoverRef.value?.$el
70
66
 
71
- if (!button) {
72
- console.error('Cannot find the button of the Toggletip.)')
67
+ if (!popover) {
68
+ console.error('Cannot find the popover of the Toggletip.)')
73
69
  return
74
70
  }
75
-
76
- const buttonRect = button.getBoundingClientRect()
71
+ console.log(popover)
72
+ const popoverRect = popover.getBoundingClientRect()
77
73
  panelStyle.value = {
78
- left: `${buttonRect.left + window.scrollX}px`,
79
- top: `${buttonRect.bottom + window.scrollY}px`,
74
+ left: `${popoverRect.left + window.scrollX}px`,
75
+ top: `${popoverRect.bottom + window.scrollY}px`,
80
76
  }
81
77
  })
82
78
  }
@@ -5,7 +5,7 @@ export type Option = {
5
5
  id: string
6
6
  }
7
7
 
8
- export default function useActiveDescendant<T extends Option>(options: MaybeRefOrGetter<Array<T>>, direction: 'horizontal' | 'vertical') {
8
+ export function useActiveDescendant<T extends Option>(options: MaybeRefOrGetter<Array<T>>, direction: 'horizontal' | 'vertical') {
9
9
  const active = ref<string | undefined>()
10
10
 
11
11
  const activeOption = computed<T | undefined>(() => toValue(options).find(option => option.id === active.value))
@@ -8,7 +8,7 @@ function constructUrl(baseUrl: string, path: string): string {
8
8
  return url.toString()
9
9
  }
10
10
 
11
- export default function getDatasetOEmbedHtml(type: string, id: string): string {
11
+ export function getDatasetOEmbedHtml(type: string, id: string): string {
12
12
  const config = useComponentsConfig()
13
13
 
14
14
  const staticUrl = constructUrl(config.baseUrl, 'oembed.js')
@@ -91,7 +91,7 @@ export function isOrganizationCertified(organization: Organization | null): bool
91
91
  return hasBadge(organization, CERTIFIED) && (isType(organization, PUBLIC_SERVICE) || isType(organization, LOCAL_AUTHORITY))
92
92
  }
93
93
 
94
- export default function getOrganizationOEmbedHtml(type: string, id: string): string {
94
+ export function getOrganizationOEmbedHtml(type: string, id: string): string {
95
95
  const config = useComponentsConfig()
96
96
 
97
97
  const staticUrl = constructUrl(config.baseUrl, 'oembed.js')
package/src/main.ts CHANGED
@@ -33,6 +33,7 @@ import DatasetQualityInline from './components/DatasetQualityInline.vue'
33
33
  import DatasetQualityItem from './components/DatasetQualityItem.vue'
34
34
  import DatasetQualityScore from './components/DatasetQualityScore.vue'
35
35
  import DatasetQualityTooltipContent from './components/DatasetQualityTooltipContent.vue'
36
+ import ExtraAccordion from './components/ExtraAccordion.vue'
36
37
  import OrganizationCard from './components/OrganizationCard.vue'
37
38
  import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
38
39
  import OwnerType from './components/OwnerType.vue'
@@ -44,26 +45,34 @@ import ResourceAccordion from './components/ResourceAccordion/ResourceAccordion.
44
45
  import ResourceIcon from './components/ResourceAccordion/ResourceIcon.vue'
45
46
  import Swagger from './components/ResourceAccordion/Swagger.client.vue'
46
47
  import ReuseCard from './components/ReuseCard.vue'
48
+ import ReuseDetails from './components/ReuseDetails.vue'
47
49
  import SimpleBanner from './components/SimpleBanner.vue'
48
50
  import StatBox from './components/StatBox.vue'
51
+ import Tab from './components/Tabs/Tab.vue'
52
+ import TabGroup from './components/Tabs/TabGroup.vue'
53
+ import TabList from './components/Tabs/TabList.vue'
54
+ import TabPanel from './components/Tabs/TabPanel.vue'
55
+ import TabPanels from './components/Tabs/TabPanels.vue'
49
56
  import Tooltip from './components/Tooltip.vue'
50
57
  import Toggletip from './components/Toggletip.vue'
51
58
  import type { UseFetchFunction } from './functions/api.types'
52
59
  import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
53
60
 
61
+ export * from './composables/useActiveDescendant'
54
62
  export * from './composables/useReuseType'
55
63
 
56
- export * from './functions/dates'
57
- export * from './functions/organizations'
58
- export * from './functions/resources'
59
- export * from './functions/users'
60
64
  export * from './functions/datasets'
61
- export * from './functions/owned'
65
+ export * from './functions/dates'
62
66
  export * from './functions/helpers'
67
+ export * from './functions/markdown'
63
68
  export * from './functions/matomo'
64
69
  export * from './functions/never'
70
+ export * from './functions/organizations'
71
+ export * from './functions/owned'
72
+ export * from './functions/resources'
73
+ export * from './functions/reuses'
65
74
  export * from './functions/schemas'
66
- export * from './functions/markdown'
75
+ export * from './functions/users'
67
76
 
68
77
  export type {
69
78
  UseFetchFunction,
@@ -159,6 +168,7 @@ export {
159
168
  DatasetQualityScore,
160
169
  DatasetQualityTooltipContent,
161
170
  DateRangeDetails,
171
+ ExtraAccordion,
162
172
  OrganizationCard,
163
173
  OrganizationNameWithCertificate,
164
174
  OwnerType,
@@ -169,9 +179,15 @@ export {
169
179
  ResourceAccordion,
170
180
  ResourceIcon,
171
181
  ReuseCard,
182
+ ReuseDetails,
172
183
  SimpleBanner,
173
184
  StatBox,
174
185
  Swagger,
186
+ Tab,
187
+ TabGroup,
188
+ TabList,
189
+ TabPanel,
190
+ TabPanels,
175
191
  Tooltip,
176
192
  Toggletip,
177
193
  }
@@ -69,6 +69,7 @@ export type Dataset = BaseDataset & {
69
69
  slug: string
70
70
  quality: Quality
71
71
  metrics: {
72
+ dataservices: number
72
73
  discussions: number
73
74
  discussions_open: number
74
75
  followers: number
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-Qu3kUOIH.js";
2
- export {
3
- f as default
4
- };