@datagouv/components-next 1.4.1-dev.1373.g379aceb6 → 1.4.1-dev.1375.ge1f9e509
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/assets/main.css +4 -0
- package/dist/{Control-CeBb5PEu.js → Control-DPuXeUqi.js} +3 -12
- package/dist/{Datafair.client-Ci2WOgAS.js → Datafair.client-LlEgG7WU.js} +2 -3
- package/dist/{Image-CBQwYbQB.js → Image-DVWRoLLI.js} +7 -22
- package/dist/{ImagePreview.client-B4RtxuiJ.js → ImagePreview.client-Db5dmxMP.js} +2 -3
- package/dist/{JsonPreview.client-r7swv2fp.js → JsonPreview.client-DKy2AexC.js} +4 -6
- package/dist/{Layer-BPuffNS-.js → Layer-D_5tYbVm.js} +7 -9
- package/dist/{Map-QeL96qbQ.js → Map-CTBJEae_.js} +937 -967
- package/dist/{MapContainer.client-CxH1a8Tn.js → MapContainer.client-Clk9_bbS.js} +13 -15
- package/dist/{OSM-DT4I7v8A.js → OSM-B5Zc3qAf.js} +2 -3
- package/dist/{PdfPreview.client-BjeMcqcy.js → PdfPreview.client-D3wHTDb9.js} +130 -378
- package/dist/{PdfSkeleton-CVZxJaeL.js → PdfSkeleton-nas5Pmia.js} +2 -3
- package/dist/{Pmtiles.client-D8idR2l7.js → Pmtiles.client-NGYdeSJY.js} +151 -350
- package/dist/{PreviewError-Cx7CItT_.js → PreviewError-EeaGx3SL.js} +399 -392
- package/dist/{PreviewWrapper-Cd1RSmS-.js → PreviewWrapper-BhldDdXK.js} +2 -3
- package/dist/{ScaleLine-Cwwk9wJo.js → ScaleLine-C_tuJ6VG.js} +3 -4
- package/dist/Tile-8nHSuqcv.js +571 -0
- package/dist/{Tile-4WpHaLOZ.js → Tile-Bu5lF4M5.js} +8 -13
- package/dist/{TileImage-CZZ4lgsm.js → TileImage-CgO5alXc.js} +105 -113
- package/dist/{View-DWqx4Jqr.js → View-Dad8DfSD.js} +25 -51
- package/dist/{XmlPreview.client-cSebx8br.js → XmlPreview.client-CmGbc3c3.js} +5 -7
- package/dist/assets/maplibre-gl-worker-CEzvAyZY.js +10 -0
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +15585 -15914
- package/dist/components.css +1 -1
- package/dist/{en-C_qOt4Jn.js → en-OIaJCts4.js} +1 -2
- package/dist/{france-DPcdJc84.js → france-BtSQqcqV.js} +5 -9
- package/dist/{hvd-ZlsiTVFh.js → hvd-CTia2VCz.js} +1 -2
- package/dist/{inspire-DZQ-yA5f.js → inspire-Cc-Kc4K-.js} +1 -2
- package/dist/{leaflet-src-lLkzhpcP.js → leaflet-src-BY_Zq0V0.js} +77 -126
- package/dist/{proj-DM6GW1n3.js → proj-COhZ08DR.js} +19 -37
- package/dist/{purify.es-D6pPunDo.js → purify.es-CGAWnSTR.js} +4 -27
- package/dist/{rolldown-runtime-CEFd7nDs.js → rolldown-runtime-DsPmjQRF.js} +2 -3
- package/dist/{sl-BxQ_ZY_w.js → sl-CKkMwQhf.js} +1 -2
- package/dist/{spd-Cs37HjuR.js → spd-Djcs02gw.js} +1 -2
- package/dist/{sr-JDtennFO.js → sr-DabGmchD.js} +1 -2
- package/dist/{src-D_UE0st7.js → src-D_o-aUzl.js} +1612 -2428
- package/dist/{text-clamp.esm-DRvX2Gzm.js → text-clamp.esm-DE3022VR.js} +3 -5
- package/dist/{transform-Ct1GejD-.js → transform-CNeEnSK9.js} +7 -13
- package/dist/{vue3-json-viewer-BJgUfh-l.js → vue3-json-viewer-CUx5EFVA.js} +1 -2
- package/dist/{vue3-xml-viewer.common-DbJwzvCC.js → vue3-xml-viewer.common-C0bbtsGT.js} +2 -3
- package/package.json +2 -2
- package/src/components/CardMedia.vue +42 -0
- package/src/components/ChartCard.vue +53 -59
- package/src/components/DataserviceCard.vue +69 -85
- package/src/components/DataserviceQualityInline.vue +4 -20
- package/src/components/DataserviceQualityTooltipContent.vue +57 -65
- package/src/components/DatasetCard.vue +80 -93
- package/src/components/DatasetQualityInline.vue +4 -20
- package/src/components/DatasetQualityTooltipContent.vue +60 -62
- package/src/components/DiscussionMessageCard.vue +19 -22
- package/src/components/ObjectCard.vue +89 -18
- package/src/components/ObjectCardBadge.vue +27 -16
- package/src/components/ObjectCardMeta.vue +15 -0
- package/src/components/ObjectCardMetric.vue +23 -0
- package/src/components/ObjectCardMetrics.vue +6 -0
- package/src/components/ObjectCardOwner.vue +170 -17
- package/src/components/ObjectCardQuality.vue +32 -0
- package/src/components/ObjectCardShortDescription.vue +1 -1
- package/src/components/OrganizationCard.vue +101 -69
- package/src/components/OrganizationNameInline.vue +49 -0
- package/src/components/OrganizationTypeBadge.vue +21 -0
- package/src/components/OwnerType.vue +1 -1
- package/src/components/OwnerTypeIcon.vue +7 -3
- package/src/components/PostCard.vue +31 -35
- package/src/components/ProgressBar.vue +6 -3
- package/src/components/QualityItem.vue +9 -18
- package/src/components/QualityScore.vue +7 -1
- package/src/components/ReuseCard.vue +114 -95
- package/src/components/ReuseDetails.vue +19 -29
- package/src/components/SchemaCard.vue +30 -27
- package/src/components/Search/GlobalSearch.vue +7 -4
- package/src/components/Toggletip.vue +24 -12
- package/src/components/Tooltip.vue +113 -29
- package/src/components/TopicCard.vue +69 -78
- package/src/main.ts +0 -4
- package/dist/Tile-BV44yf69.js +0 -574
- package/dist/assets/maplibre-gl-worker-C24SsKwV.js +0 -10
- package/src/components/ObjectCardHeader.vue +0 -42
- package/src/components/OrganizationHorizontalCard.vue +0 -87
- package/src/components/ReuseHorizontalCard.vue +0 -81
|
@@ -1,115 +1,134 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:organization="reuse.organization"
|
|
20
|
-
:owner="reuse.owner"
|
|
21
|
-
:organization-url="organizationUrl"
|
|
22
|
-
/>
|
|
23
|
-
<RiSubtractLine class="size-4 flex-none fill-gray-medium" />
|
|
24
|
-
<TranslationT
|
|
25
|
-
class="block flex-none"
|
|
26
|
-
keypath="publié {date}"
|
|
27
|
-
>
|
|
28
|
-
<template #date>
|
|
29
|
-
<FormattedDate
|
|
30
|
-
:date="reuse.created_at"
|
|
31
|
-
format="relative"
|
|
32
|
-
:options="{ dateStyle: 'medium' }"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
35
|
-
</TranslationT>
|
|
36
|
-
</div>
|
|
37
|
-
<ReuseDetails :reuse />
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="order-1 relative flex-auto">
|
|
42
|
-
<div class="group-hover/reuse-card:brightness-90">
|
|
43
|
-
<div class="object-cover block w-full h-auto aspect-[1.4]">
|
|
44
|
-
<img
|
|
45
|
-
v-if="reuse.image"
|
|
46
|
-
:src="reuse.image"
|
|
47
|
-
class="size-full object-cover"
|
|
48
|
-
>
|
|
49
|
-
<Placeholder
|
|
50
|
-
v-else
|
|
51
|
-
type="Reuse"
|
|
52
|
-
class="w-full"
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
2
|
+
<ObjectCard
|
|
3
|
+
:url="reuseUrl || reuse.page"
|
|
4
|
+
:icon="horizontal ? RiLineChartLine : undefined"
|
|
5
|
+
:title-tag
|
|
6
|
+
:media-size="horizontal ? 'lg' : undefined"
|
|
7
|
+
>
|
|
8
|
+
<template
|
|
9
|
+
v-if="!horizontal"
|
|
10
|
+
#cover
|
|
11
|
+
>
|
|
12
|
+
<div class="relative aspect-video border-b border-gray-default">
|
|
13
|
+
<CardMedia
|
|
14
|
+
:src="reuse.image"
|
|
15
|
+
:alt="reuse.title"
|
|
16
|
+
kind="reuse"
|
|
17
|
+
class="absolute inset-0"
|
|
18
|
+
/>
|
|
55
19
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
20
|
+
</template>
|
|
21
|
+
<template
|
|
22
|
+
v-if="horizontal"
|
|
23
|
+
#media
|
|
24
|
+
>
|
|
25
|
+
<CardMedia
|
|
26
|
+
:src="reuse.image"
|
|
27
|
+
:alt="reuse.title"
|
|
28
|
+
kind="reuse"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
<template #title>
|
|
32
|
+
{{ reuse.title }}
|
|
33
|
+
</template>
|
|
34
|
+
<template
|
|
35
|
+
v-if="reuse.private || reuse.archived"
|
|
36
|
+
#badge
|
|
37
|
+
>
|
|
38
|
+
<span class="flex flex-wrap gap-1">
|
|
39
|
+
<ObjectCardBadge
|
|
40
|
+
v-if="reuse.private"
|
|
41
|
+
:icon="RiLockLine"
|
|
42
|
+
>
|
|
43
|
+
{{ t('Brouillon') }}
|
|
44
|
+
</ObjectCardBadge>
|
|
45
|
+
<ObjectCardBadge
|
|
46
|
+
v-if="reuse.archived"
|
|
47
|
+
:icon="RiArchiveLine"
|
|
48
|
+
>
|
|
49
|
+
{{ t('Archivé') }}
|
|
50
|
+
</ObjectCardBadge>
|
|
51
|
+
</span>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<ObjectCardOwner
|
|
55
|
+
show-details
|
|
56
|
+
:organization="reuse.organization"
|
|
57
|
+
:owner="reuse.owner"
|
|
58
|
+
:organization-url="organizationUrl"
|
|
59
|
+
/>
|
|
60
|
+
<ObjectCardMeta>
|
|
61
|
+
<TranslationT
|
|
62
|
+
tag="span"
|
|
63
|
+
class="tabular-nums"
|
|
64
|
+
keypath="Publié {date}"
|
|
59
65
|
>
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
<template #date>
|
|
67
|
+
<FormattedDate
|
|
68
|
+
:date="reuse.created_at"
|
|
69
|
+
format="relative"
|
|
70
|
+
:options="{ dateStyle: 'medium' }"
|
|
71
|
+
/>
|
|
72
|
+
</template>
|
|
73
|
+
</TranslationT>
|
|
74
|
+
</ObjectCardMeta>
|
|
75
|
+
<ReuseDetails
|
|
76
|
+
:reuse
|
|
77
|
+
class="max-[480px]:hidden"
|
|
78
|
+
/>
|
|
79
|
+
<ObjectCardShortDescription
|
|
80
|
+
:text="reuse.description"
|
|
81
|
+
class="max-md:hidden"
|
|
82
|
+
/>
|
|
83
|
+
<slot />
|
|
84
|
+
</ObjectCard>
|
|
75
85
|
</template>
|
|
76
86
|
|
|
77
87
|
<script setup lang="ts">
|
|
78
|
-
import {
|
|
79
|
-
import { computed } from 'vue'
|
|
88
|
+
import { RiArchiveLine, RiLineChartLine, RiLockLine } from '@remixicon/vue'
|
|
80
89
|
import type { RouteLocationRaw } from 'vue-router'
|
|
81
90
|
import type { Reuse, ReuseV2 } from '../types/reuses'
|
|
82
91
|
import type { TitleTag } from '../types/ui'
|
|
83
92
|
import { useTranslation } from '../composables/useTranslation'
|
|
84
|
-
import
|
|
93
|
+
import CardMedia from './CardMedia.vue'
|
|
94
|
+
import FormattedDate from './FormattedDate.vue'
|
|
95
|
+
import ObjectCard from './ObjectCard.vue'
|
|
96
|
+
import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
|
|
97
|
+
import ObjectCardBadge from './ObjectCardBadge.vue'
|
|
98
|
+
import ObjectCardMeta from './ObjectCardMeta.vue'
|
|
85
99
|
import ObjectCardOwner from './ObjectCardOwner.vue'
|
|
86
100
|
import ReuseDetails from './ReuseDetails.vue'
|
|
87
|
-
import Placeholder from './Placeholder.vue'
|
|
88
|
-
import FormattedDate from './FormattedDate.vue'
|
|
89
101
|
import TranslationT from './TranslationT.vue'
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
|
|
103
|
+
withDefaults(
|
|
104
|
+
defineProps<{
|
|
105
|
+
reuse: Reuse | ReuseV2
|
|
93
106
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
/**
|
|
108
|
+
* The reuseUrl is a route location object to allow Vue Router to navigate to the details of a reuse.
|
|
109
|
+
* It is used as a separate prop to allow other sites using the package to define their own reuse pages.
|
|
110
|
+
*/
|
|
111
|
+
reuseUrl?: RouteLocationRaw
|
|
99
112
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
/**
|
|
114
|
+
* The organizationUrl is an optional route location object to allow Vue Router to navigate to the details of the organization linked to tha reuse.
|
|
115
|
+
* It is used as a separate prop to allow other sites using the package to define their own organization pages.
|
|
116
|
+
* Pass null instead of a route to render the organization name as plain, non-linked text.
|
|
117
|
+
*/
|
|
118
|
+
organizationUrl?: RouteLocationRaw | null
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
}>(), {
|
|
109
|
-
titleTag: 'h3',
|
|
110
|
-
})
|
|
120
|
+
titleTag?: TitleTag
|
|
111
121
|
|
|
112
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Puts the illustration beside the content instead of above it, for full-width lists.
|
|
124
|
+
* The card falls back to the vertical layout when it gets too narrow.
|
|
125
|
+
*/
|
|
126
|
+
horizontal?: boolean
|
|
127
|
+
}>(),
|
|
128
|
+
{
|
|
129
|
+
titleTag: 'h3',
|
|
130
|
+
},
|
|
131
|
+
)
|
|
113
132
|
|
|
114
|
-
const
|
|
133
|
+
const { t } = useTranslation()
|
|
115
134
|
</script>
|
|
@@ -1,39 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/>{{ summarize(reuse.metrics.views) }}
|
|
18
|
-
</p>
|
|
19
|
-
<p
|
|
20
|
-
class="text-sm mb-0 flex items-center gap-0.5"
|
|
21
|
-
:aria-label="t('{n} abonnés | {n} abonné | {n} abonnés', reuse.metrics.followers)"
|
|
22
|
-
>
|
|
23
|
-
<RiStarLine
|
|
24
|
-
aria-hidden="true"
|
|
25
|
-
class="size-3.5"
|
|
26
|
-
/>{{ summarize(reuse.metrics.followers) }}
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
2
|
+
<ObjectCardMeta>
|
|
3
|
+
<span v-if="reuseType">{{ reuseType }}</span>
|
|
4
|
+
<ObjectCardMetrics>
|
|
5
|
+
<ObjectCardMetric
|
|
6
|
+
:icon="RiEyeLine"
|
|
7
|
+
:value="reuse.metrics.views"
|
|
8
|
+
:label="t('{n} vues | {n} vue | {n} vues', reuse.metrics.views)"
|
|
9
|
+
/>
|
|
10
|
+
<ObjectCardMetric
|
|
11
|
+
:icon="RiStarLine"
|
|
12
|
+
:value="reuse.metrics.followers"
|
|
13
|
+
:label="t('{n} abonnés | {n} abonné | {n} abonnés', reuse.metrics.followers)"
|
|
14
|
+
/>
|
|
15
|
+
</ObjectCardMetrics>
|
|
16
|
+
</ObjectCardMeta>
|
|
29
17
|
</template>
|
|
30
18
|
|
|
31
19
|
<script setup lang="ts">
|
|
32
|
-
import { RiEyeLine, RiStarLine
|
|
20
|
+
import { RiEyeLine, RiStarLine } from '@remixicon/vue'
|
|
33
21
|
import { useReuseType } from '../composables/useReuseType'
|
|
34
|
-
import { summarize } from '../functions/helpers'
|
|
35
22
|
import type { Reuse, ReuseV2 } from '../types/reuses'
|
|
36
23
|
import { useTranslation } from '../composables/useTranslation'
|
|
24
|
+
import ObjectCardMeta from './ObjectCardMeta.vue'
|
|
25
|
+
import ObjectCardMetric from './ObjectCardMetric.vue'
|
|
26
|
+
import ObjectCardMetrics from './ObjectCardMetrics.vue'
|
|
37
27
|
|
|
38
28
|
const props = defineProps<{
|
|
39
29
|
reuse: Reuse | ReuseV2
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:id
|
|
4
|
-
class="p-4
|
|
5
|
-
:class="
|
|
6
|
-
'border-
|
|
7
|
-
'
|
|
8
|
-
|
|
9
|
-
}"
|
|
4
|
+
class="relative p-4 rounded border text-sm/[22px] text-gray-title [overflow-wrap:anywhere]"
|
|
5
|
+
:class="[
|
|
6
|
+
selectable && selected ? 'border-new-primary ring-1 ring-inset ring-new-primary bg-new-info-light' : 'border-gray-default bg-white',
|
|
7
|
+
{ 'outline-2 outline-new-focus outline-offset-3': active },
|
|
8
|
+
]"
|
|
10
9
|
:role="selectable ? 'option' : undefined"
|
|
11
10
|
:tabindex="selectable ? -1 : undefined"
|
|
12
11
|
:aria-selected="selectable && selected"
|
|
13
12
|
>
|
|
14
|
-
<h3 class="
|
|
15
|
-
<RiNodeTree
|
|
13
|
+
<h3 class="m-0 flex items-start gap-2 pr-8 text-base/6 font-semibold">
|
|
14
|
+
<RiNodeTree
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="size-4 shrink-0 mt-1"
|
|
17
|
+
/>
|
|
16
18
|
{{ schema.title }}
|
|
17
19
|
</h3>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<p class="text-sm mt-4 mb-0">
|
|
20
|
+
<div class="flex flex-wrap gap-1 my-2">
|
|
21
|
+
<Tag
|
|
22
|
+
v-for="label in schema.labels"
|
|
23
|
+
:key="label"
|
|
24
|
+
type="secondary"
|
|
25
|
+
>
|
|
26
|
+
{{ t('Label :') }} {{ label }}
|
|
27
|
+
</Tag>
|
|
28
|
+
<Tag
|
|
29
|
+
v-if="schema.schema_type"
|
|
30
|
+
type="secondary"
|
|
31
|
+
>
|
|
32
|
+
{{ t('Standard :') }} {{ schema.schema_type }}
|
|
33
|
+
</Tag>
|
|
34
|
+
</div>
|
|
35
|
+
<p class="text-sm mt-2 mb-0 text-gray-medium">
|
|
35
36
|
{{ schema.description }}
|
|
36
37
|
</p>
|
|
37
38
|
<p
|
|
@@ -64,13 +65,15 @@
|
|
|
64
65
|
</p>
|
|
65
66
|
<RiCheckLine
|
|
66
67
|
v-if="selected"
|
|
67
|
-
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
class="absolute top-4 right-4 size-5"
|
|
68
70
|
/>
|
|
69
71
|
</div>
|
|
70
72
|
</template>
|
|
71
73
|
|
|
72
74
|
<script setup lang="ts">
|
|
73
|
-
import
|
|
75
|
+
import Tag from './Tag.vue'
|
|
76
|
+
import { RiCheckLine, RiNodeTree } from '@remixicon/vue'
|
|
74
77
|
import AppLink from './AppLink.vue'
|
|
75
78
|
import { useTranslation } from '../composables/useTranslation'
|
|
76
79
|
import { useGetSchemaDocumentation } from '../functions/schemas'
|
|
@@ -266,7 +266,10 @@
|
|
|
266
266
|
name="reuse"
|
|
267
267
|
:reuse="result"
|
|
268
268
|
>
|
|
269
|
-
<
|
|
269
|
+
<ReuseCard
|
|
270
|
+
:reuse="(result as ReuseV2)"
|
|
271
|
+
horizontal
|
|
272
|
+
/>
|
|
270
273
|
</slot>
|
|
271
274
|
</template>
|
|
272
275
|
<template v-else-if="currentTypeConfig?.class === 'organizations'">
|
|
@@ -274,7 +277,7 @@
|
|
|
274
277
|
name="organization"
|
|
275
278
|
:organization="result"
|
|
276
279
|
>
|
|
277
|
-
<
|
|
280
|
+
<OrganizationCard :organization="(result as Organization)" />
|
|
278
281
|
</slot>
|
|
279
282
|
</template>
|
|
280
283
|
<template v-else-if="currentTypeConfig?.class === 'topics'">
|
|
@@ -382,8 +385,8 @@ import RadioGroup from '../RadioGroup.vue'
|
|
|
382
385
|
import RadioInput from '../RadioInput.vue'
|
|
383
386
|
import DatasetCard from '../DatasetCard.vue'
|
|
384
387
|
import DataserviceCard from '../DataserviceCard.vue'
|
|
385
|
-
import
|
|
386
|
-
import
|
|
388
|
+
import OrganizationCard from '../OrganizationCard.vue'
|
|
389
|
+
import ReuseCard from '../ReuseCard.vue'
|
|
387
390
|
import TopicCard from '../TopicCard.vue'
|
|
388
391
|
import SearchInput from './SearchInput.vue'
|
|
389
392
|
import Sidemenu from './Sidemenu.vue'
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<ValueWatcher
|
|
12
12
|
:value="open"
|
|
13
|
+
@changed="onOpenChanged"
|
|
13
14
|
/>
|
|
14
15
|
<PopoverButton
|
|
15
16
|
v-bind="buttonProps"
|
|
@@ -31,11 +32,8 @@
|
|
|
31
32
|
<PopoverPanel
|
|
32
33
|
v-show="open"
|
|
33
34
|
ref="panel"
|
|
34
|
-
class="
|
|
35
|
-
:class="
|
|
36
|
-
'p-0': noMargin,
|
|
37
|
-
'p-3': !noMargin,
|
|
38
|
-
}"
|
|
35
|
+
class="absolute z-[800] w-[min(24rem,calc(100vw-2rem))] max-h-[70vh] overflow-auto rounded border border-gray-default bg-white shadow-overlay"
|
|
36
|
+
:class="noMargin ? 'p-0' : 'p-4'"
|
|
39
37
|
:style="floatingStyles"
|
|
40
38
|
static
|
|
41
39
|
>
|
|
@@ -50,9 +48,9 @@
|
|
|
50
48
|
</template>
|
|
51
49
|
|
|
52
50
|
<script setup lang="ts">
|
|
53
|
-
import { autoPlacement, autoUpdate, useFloating } from '@floating-ui/vue'
|
|
51
|
+
import { autoPlacement, autoUpdate, offset, shift, useFloating } from '@floating-ui/vue'
|
|
54
52
|
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
|
|
55
|
-
import { useTemplateRef } from 'vue'
|
|
53
|
+
import { nextTick, useTemplateRef } from 'vue'
|
|
56
54
|
import { RiInformationLine } from '@remixicon/vue'
|
|
57
55
|
import ClientOnly from './ClientOnly.vue'
|
|
58
56
|
import ValueWatcher from './ValueWatcher.vue'
|
|
@@ -66,14 +64,28 @@ withDefaults(defineProps<{
|
|
|
66
64
|
styledButton: true,
|
|
67
65
|
})
|
|
68
66
|
|
|
67
|
+
const emit = defineEmits<{
|
|
68
|
+
opened: []
|
|
69
|
+
}>()
|
|
70
|
+
|
|
69
71
|
const popoverRef = useTemplateRef<InstanceType<typeof Popover>>('popover')
|
|
70
72
|
const panelRef = useTemplateRef<InstanceType<typeof PopoverPanel>>('panel')
|
|
71
73
|
|
|
72
|
-
const { floatingStyles } = useFloating(popoverRef, panelRef, {
|
|
73
|
-
middleware: [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const { floatingStyles, update } = useFloating(popoverRef, panelRef, {
|
|
75
|
+
middleware: [
|
|
76
|
+
offset(8),
|
|
77
|
+
autoPlacement({
|
|
78
|
+
alignment: 'end',
|
|
79
|
+
crossAxis: true,
|
|
80
|
+
}),
|
|
81
|
+
shift({ padding: 16 }),
|
|
82
|
+
],
|
|
77
83
|
whileElementsMounted: autoUpdate,
|
|
78
84
|
})
|
|
85
|
+
|
|
86
|
+
async function onOpenChanged(open: boolean) {
|
|
87
|
+
if (open) emit('opened')
|
|
88
|
+
await nextTick()
|
|
89
|
+
update()
|
|
90
|
+
}
|
|
79
91
|
</script>
|
|
@@ -1,57 +1,141 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
|
+
:is="as"
|
|
3
4
|
class="relative"
|
|
4
|
-
@focusin="
|
|
5
|
-
@mouseenter="
|
|
5
|
+
@focusin="open"
|
|
6
|
+
@mouseenter="open"
|
|
6
7
|
@focusout="show = false"
|
|
7
|
-
@mouseleave="
|
|
8
|
+
@mouseleave="closeSoon"
|
|
9
|
+
@keydown.esc="dismiss"
|
|
8
10
|
>
|
|
9
11
|
<span
|
|
10
12
|
ref="reference"
|
|
11
13
|
v-bind="$attrs"
|
|
12
|
-
:
|
|
14
|
+
:tabindex="needsFocus ? 0 : undefined"
|
|
13
15
|
>
|
|
14
16
|
<slot />
|
|
15
17
|
</span>
|
|
16
18
|
|
|
17
|
-
<
|
|
19
|
+
<Teleport
|
|
18
20
|
v-if="show"
|
|
19
|
-
|
|
20
|
-
ref="floating"
|
|
21
|
-
role="tooltip"
|
|
22
|
-
aria-hidden="true"
|
|
23
|
-
class="z-10 pt-2"
|
|
24
|
-
:class="tooltipClass"
|
|
25
|
-
:style="loaded ? floatingStyles : ''"
|
|
21
|
+
to="#tooltips"
|
|
26
22
|
>
|
|
27
|
-
<div
|
|
28
|
-
|
|
23
|
+
<div
|
|
24
|
+
:id
|
|
25
|
+
ref="floating"
|
|
26
|
+
role="tooltip"
|
|
27
|
+
class="z-[900] pt-2"
|
|
28
|
+
:class="tooltipClass"
|
|
29
|
+
:style="floatingStyles"
|
|
30
|
+
@mouseenter="open"
|
|
31
|
+
@mouseleave="closeSoon"
|
|
32
|
+
>
|
|
33
|
+
<div class="w-max max-w-[min(22rem,calc(100vw-2rem))] p-3 rounded border border-gray-default bg-white shadow-overlay text-sm/[22px] text-gray-title [overflow-wrap:anywhere]">
|
|
34
|
+
<slot name="tooltip" />
|
|
35
|
+
</div>
|
|
29
36
|
</div>
|
|
30
|
-
</
|
|
31
|
-
</
|
|
37
|
+
</Teleport>
|
|
38
|
+
</component>
|
|
32
39
|
</template>
|
|
33
40
|
|
|
34
41
|
<script setup lang="ts">
|
|
35
|
-
import { useFloating, autoUpdate, autoPlacement } from '@floating-ui/vue'
|
|
36
|
-
import {
|
|
42
|
+
import { useFloating, autoUpdate, autoPlacement, shift } from '@floating-ui/vue'
|
|
43
|
+
import { useEventListener } from '@vueuse/core'
|
|
44
|
+
import { onBeforeUnmount, onMounted, ref, useId, useTemplateRef, watchEffect } from 'vue'
|
|
37
45
|
|
|
38
|
-
defineProps<{
|
|
46
|
+
withDefaults(defineProps<{
|
|
39
47
|
tooltipClass?: string
|
|
40
|
-
|
|
48
|
+
as?: string
|
|
49
|
+
}>(), {
|
|
50
|
+
as: 'div',
|
|
51
|
+
})
|
|
41
52
|
|
|
42
53
|
const id = useId()
|
|
43
54
|
const show = ref(false)
|
|
44
|
-
const loaded = ref(false)
|
|
45
55
|
|
|
46
|
-
const referenceRef = useTemplateRef('reference')
|
|
47
|
-
const floatingRef = useTemplateRef('floating')
|
|
56
|
+
const referenceRef = useTemplateRef<HTMLElement>('reference')
|
|
57
|
+
const floatingRef = useTemplateRef<HTMLElement>('floating')
|
|
48
58
|
const { floatingStyles } = useFloating(referenceRef, floatingRef, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
strategy: 'fixed',
|
|
60
|
+
middleware: [
|
|
61
|
+
autoPlacement({
|
|
62
|
+
allowedPlacements: ['bottom-start', 'bottom', 'bottom-end'],
|
|
63
|
+
crossAxis: true,
|
|
64
|
+
}),
|
|
65
|
+
shift({ padding: 16 }),
|
|
66
|
+
],
|
|
53
67
|
whileElementsMounted: autoUpdate,
|
|
54
68
|
})
|
|
55
69
|
|
|
56
|
-
|
|
70
|
+
// Inside a link or a button, the focus lands on that element, never on the tooltip itself:
|
|
71
|
+
// the tooltip follows its keyboard focus instead.
|
|
72
|
+
const focusableParent = ref<HTMLElement | null>(null)
|
|
73
|
+
// Around a plain icon or text, nothing could take the focus: the tooltip would stay out of
|
|
74
|
+
// reach of the keyboard, so its content becomes focusable itself.
|
|
75
|
+
const needsFocus = ref(false)
|
|
76
|
+
let focusedWithPointer = false
|
|
77
|
+
|
|
78
|
+
function onParentFocus(event: FocusEvent) {
|
|
79
|
+
show.value = !focusedWithPointer && (event.currentTarget as HTMLElement).matches(':focus-visible')
|
|
80
|
+
}
|
|
81
|
+
function onParentPointerDown() {
|
|
82
|
+
focusedWithPointer = true
|
|
83
|
+
show.value = false
|
|
84
|
+
}
|
|
85
|
+
function onParentBlur() {
|
|
86
|
+
focusedWithPointer = false
|
|
87
|
+
show.value = false
|
|
88
|
+
}
|
|
89
|
+
function onParentKeydown(event: KeyboardEvent) {
|
|
90
|
+
focusedWithPointer = false
|
|
91
|
+
// Activating the parent opens what it controls, which the tooltip would cover.
|
|
92
|
+
if (event.key === 'Enter' || event.key === ' ') show.value = false
|
|
93
|
+
if (event.key === 'Escape') dismiss(event)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
useEventListener(focusableParent, 'focus', onParentFocus)
|
|
97
|
+
useEventListener(focusableParent, 'pointerdown', onParentPointerDown)
|
|
98
|
+
useEventListener(focusableParent, 'blur', onParentBlur)
|
|
99
|
+
useEventListener(focusableParent, 'keydown', onParentKeydown)
|
|
100
|
+
|
|
101
|
+
onMounted(() => {
|
|
102
|
+
const parent = referenceRef.value?.parentElement?.closest<HTMLElement>('a, button') ?? null
|
|
103
|
+
focusableParent.value = parent
|
|
104
|
+
needsFocus.value = !parent && !referenceRef.value?.querySelector('a, button, input, select, textarea, [tabindex]')
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// The tooltip is teleported out of the reference: moving the pointer from one to the other
|
|
108
|
+
// leaves the reference first, so closing waits for the pointer to reach the tooltip, whose
|
|
109
|
+
// content (a link for instance) must stay usable.
|
|
110
|
+
let closeTimeout: ReturnType<typeof setTimeout> | undefined
|
|
111
|
+
function open() {
|
|
112
|
+
clearTimeout(closeTimeout)
|
|
113
|
+
show.value = true
|
|
114
|
+
}
|
|
115
|
+
function closeSoon() {
|
|
116
|
+
clearTimeout(closeTimeout)
|
|
117
|
+
closeTimeout = setTimeout(() => show.value = false, 100)
|
|
118
|
+
}
|
|
119
|
+
onBeforeUnmount(() => clearTimeout(closeTimeout))
|
|
120
|
+
|
|
121
|
+
// Describe the element that holds the focus, and only while the tooltip is rendered:
|
|
122
|
+
// a reference to a missing id is ignored by screen readers.
|
|
123
|
+
watchEffect((onCleanup) => {
|
|
124
|
+
const described = focusableParent.value ?? referenceRef.value
|
|
125
|
+
if (!described || !show.value) return
|
|
126
|
+
const ids = new Set(described.getAttribute('aria-describedby')?.split(/\s+/).filter(Boolean))
|
|
127
|
+
ids.add(id)
|
|
128
|
+
described.setAttribute('aria-describedby', [...ids].join(' '))
|
|
129
|
+
onCleanup(() => {
|
|
130
|
+
const remaining = described.getAttribute('aria-describedby')?.split(/\s+/).filter(value => value !== id).join(' ')
|
|
131
|
+
if (remaining) described.setAttribute('aria-describedby', remaining)
|
|
132
|
+
else described.removeAttribute('aria-describedby')
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
function dismiss(event: KeyboardEvent) {
|
|
137
|
+
if (!show.value) return
|
|
138
|
+
event.stopPropagation()
|
|
139
|
+
show.value = false
|
|
140
|
+
}
|
|
57
141
|
</script>
|