@datagouv/components-next 0.0.21 → 0.0.23

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-CgjLq1oz.js";
1
+ import { g as Ke } from "./main-qCXX5fcf.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.21",
3
+ "version": "0.0.23",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./src/main.ts",
@@ -22,6 +22,7 @@
22
22
  "publish-stable": "npm publish --access public"
23
23
  },
24
24
  "dependencies": {
25
+ "@floating-ui/vue": "^1.1.8",
25
26
  "@headlessui/vue": "^1.7.23",
26
27
  "@remixicon/vue": "^4.5.0",
27
28
  "@vueuse/core": "^13.1.0",
@@ -42,6 +42,7 @@ import { getOrganizationType, isOrganizationCertified } from '../functions/organ
42
42
  import type { Organization } from '../types/organizations'
43
43
  import { useComponentsConfig } from '../config'
44
44
  import OwnerTypeIcon from './OwnerTypeIcon.vue'
45
+ import Tooltip from './Tooltip.vue'
45
46
 
46
47
  const config = useComponentsConfig()
47
48
 
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div
3
+ class="relative"
4
+ @focusin="show = true"
5
+ @mouseenter="show = true"
6
+ @focusout="show = false"
7
+ @mouseleave="show = false"
8
+ >
9
+ <p
10
+ ref="reference"
11
+ v-bind="$attrs"
12
+ :aria-describedby="id"
13
+ class="!mb-0"
14
+ >
15
+ <slot />
16
+ </p>
17
+
18
+ <div
19
+ v-if="show"
20
+ :id
21
+ ref="floating"
22
+ role="tooltip"
23
+ aria-hidden="true"
24
+ class="z-10 pt-2"
25
+ :class="tooltipClass"
26
+ :style="loaded ? floatingStyles : ''"
27
+ >
28
+ <div class="drop-shadow bg-white p-2 whitespace-nowrap">
29
+ <slot name="tooltip" />
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup lang="ts">
36
+ import { useFloating, autoUpdate, autoPlacement } from '@floating-ui/vue'
37
+ import { onMounted, ref, useId, useTemplateRef } from 'vue'
38
+
39
+ defineProps<{
40
+ tooltipClass?: string
41
+ }>()
42
+
43
+ const id = useId()
44
+ const show = ref(false)
45
+ const loaded = ref(false)
46
+
47
+ const referenceRef = useTemplateRef('reference')
48
+ const floatingRef = useTemplateRef('floating')
49
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
50
+ middleware: [autoPlacement({
51
+ allowedPlacements: ['bottom-start', 'bottom', 'bottom-end'],
52
+ })],
53
+ whileElementsMounted: autoUpdate,
54
+ })
55
+
56
+ onMounted(() => loaded.value = true)
57
+ </script>
package/src/main.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { App, Plugin } from 'vue'
2
+ import type { ContactPoint } from './types/contact_point.js'
2
3
  import type { Badge, Badges } from './types/badges'
3
4
  import type { Dataset, DatasetV2, DatasetV2WithFullObject, NewDataset, Quality, Rel } from './types/datasets'
4
5
  import type { NewDataservice, Dataservice, DataserviceAccessAudience, DataserviceAccessAudienceCondition, DataserviceAccessAudienceType } from './types/dataservices'
@@ -43,6 +44,7 @@ import Swagger from './components/ResourceAccordion/Swagger.client.vue'
43
44
  import ReuseCard from './components/ReuseCard.vue'
44
45
  import SimpleBanner from './components/SimpleBanner.vue'
45
46
  import StatBox from './components/StatBox.vue'
47
+ import Tooltip from './components/Tooltip.vue'
46
48
  import type { UseFetchFunction } from './functions/api.types'
47
49
  import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
48
50
 
@@ -65,6 +67,7 @@ export type {
65
67
  Badge,
66
68
  Badges,
67
69
  CommunityResource,
70
+ ContactPoint,
68
71
  Dataset,
69
72
  DatasetV2,
70
73
  DatasetV2WithFullObject,
@@ -147,4 +150,5 @@ export {
147
150
  SimpleBanner,
148
151
  StatBox,
149
152
  Swagger,
153
+ Tooltip,
150
154
  }
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-CgjLq1oz.js";
2
- export {
3
- f as default
4
- };