@datagouv/components-next 1.0.2-dev.173 → 1.0.2-dev.174

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 (57) hide show
  1. package/dist/{Datafair.client-DrxHU3d_.js → Datafair.client-BU2gspr8.js} +9 -9
  2. package/dist/ImagePreview.client-BU5QNqG_.js +36 -0
  3. package/dist/{JsonPreview.client-CvmhvpbB.js → JsonPreview.client-CvOpMCxW.js} +2 -2
  4. package/dist/{MapContainer.client-9VrKlUPt.js → MapContainer.client-DNOQ5XTT.js} +9 -9
  5. package/dist/{PdfPreview.client-CiPvfzzR.js → PdfPreview.client-DwAvLLq_.js} +438 -427
  6. package/dist/{Pmtiles.client-0R3Z5sYM.js → Pmtiles.client-CgaDrCHk.js} +1341 -1337
  7. package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-CrWEJnPl.js +60 -0
  8. package/dist/{XmlPreview.client-N2n5j4WI.js → XmlPreview.client-B24FIhU7.js} +3 -3
  9. package/dist/components-next.css +1 -1
  10. package/dist/components-next.js +144 -138
  11. package/dist/components.css +1 -1
  12. package/dist/{index-D0JOBDBD.js → index-Dw1lR0oe.js} +1 -1
  13. package/dist/{leaflet-src-DxB74Wpp.js → leaflet-src-BoMqG6Yx.js} +1 -1
  14. package/dist/{main-QOs57DKh.js → main-I9G-L-lg.js} +16280 -15512
  15. package/dist/{vue3-xml-viewer.common-BnexQtzg.js → vue3-xml-viewer.common-PTUJZpH4.js} +1 -1
  16. package/package.json +1 -1
  17. package/src/components/AppLink.vue +3 -0
  18. package/src/components/CopyButton.vue +6 -2
  19. package/src/components/ResourceAccordion/Datafair.client.vue +1 -1
  20. package/src/components/ResourceAccordion/ImagePreview.client.vue +3 -3
  21. package/src/components/ResourceAccordion/MapContainer.client.vue +1 -8
  22. package/src/components/ResourceAccordion/PdfPreview.client.vue +36 -12
  23. package/src/components/ResourceAccordion/PdfSkeleton.vue +44 -0
  24. package/src/components/ResourceAccordion/Pmtiles.client.vue +25 -12
  25. package/src/components/ResourceAccordion/PreviewWrapper.vue +17 -10
  26. package/src/components/ResourceAccordion/ResourceAccordion.vue +4 -1
  27. package/src/components/ResourceExplorer/ResourceExplorer.vue +98 -209
  28. package/src/components/ResourceExplorer/ResourceExplorerHeader.vue +74 -0
  29. package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +103 -71
  30. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +123 -187
  31. package/src/components/ResourceExplorer/ResourceMainAction.vue +240 -0
  32. package/src/components/ResourceExplorer/ResourceSelector.vue +24 -86
  33. package/src/components/ResourceExplorer/ResourceViewerHeader.vue +115 -0
  34. package/src/components/ResourceExplorer/ResourceViewerSkeleton.vue +94 -0
  35. package/src/components/ResourceListItem.vue +154 -0
  36. package/src/components/TabularExplorer/TabularActiveFilters.vue +79 -0
  37. package/src/components/TabularExplorer/TabularCell.vue +2 -4
  38. package/src/components/TabularExplorer/TabularColumnsMenu.vue +112 -0
  39. package/src/components/TabularExplorer/TabularExplorer.vue +63 -994
  40. package/src/components/TabularExplorer/TabularFilterContent.vue +2 -10
  41. package/src/components/TabularExplorer/TabularFilterPopover.vue +5 -6
  42. package/src/components/TabularExplorer/TabularMobileFilterButton.vue +21 -0
  43. package/src/components/TabularExplorer/TabularMobileFilters.vue +150 -0
  44. package/src/components/TabularExplorer/TabularRowsInfo.vue +31 -0
  45. package/src/components/TabularExplorer/TabularSkeleton.vue +92 -0
  46. package/src/components/TabularExplorer/TabularTable.vue +481 -0
  47. package/src/components/TabularExplorer/TabularToolbar.vue +25 -0
  48. package/src/components/TabularExplorer/types.ts +0 -5
  49. package/src/components/TabularExplorer/useColumnMetadata.ts +98 -0
  50. package/src/components/TabularExplorer/useTabularContext.ts +82 -0
  51. package/src/composables/useDatasetResources.ts +164 -0
  52. package/src/composables/useResizable.ts +46 -0
  53. package/src/composables/useResourceCapabilities.ts +20 -7
  54. package/src/functions/resources.ts +19 -0
  55. package/src/main.ts +8 -0
  56. package/dist/ImagePreview.client-DHrr-JCM.js +0 -36
  57. package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-B0PyOeL6.js +0 -58
@@ -104,14 +104,7 @@
104
104
  />
105
105
  </span>
106
106
  <span class="flex-1 truncate text-left text-xs">
107
- <span
108
- v-if="categoryBadgeStyles?.[top.value]"
109
- class="inline-block rounded font-medium px-2 py-0.5 text-xs"
110
- :style="{ backgroundColor: categoryBadgeStyles![top.value]!.backgroundColor, color: categoryBadgeStyles![top.value]!.color }"
111
- >{{ top.value }}</span>
112
- <template v-else>
113
- {{ top.value ?? 'null' }}
114
- </template>
107
+ {{ top.value ?? 'null' }}
115
108
  </span>
116
109
  <span class="font-mono text-xs text-gray-low tabular-nums shrink-0">{{ top.count }}</span>
117
110
  </button>
@@ -224,7 +217,7 @@ import { useTranslation } from '../../composables/useTranslation'
224
217
  import { useFormatTabular } from '../../functions/tabular'
225
218
  import BrandedButton from '../BrandedButton.vue'
226
219
  import ProgressBar from '../ProgressBar.vue'
227
- import type { TabularColumnProfile, ColumnType, ColumnFilters, SortConfig, SortDirection, BadgeStyle } from './types'
220
+ import type { TabularColumnProfile, ColumnType, ColumnFilters, SortConfig, SortDirection } from './types'
228
221
 
229
222
  const props = defineProps<{
230
223
  column: string
@@ -232,7 +225,6 @@ const props = defineProps<{
232
225
  columnProfile: TabularColumnProfile | null
233
226
  nullPercent: string
234
227
  totalLines: number
235
- categoryBadgeStyles?: Record<string, BadgeStyle>
236
228
  booleanCounts?: { trueCount: number, falseCount: number }
237
229
  }>()
238
230
 
@@ -5,11 +5,12 @@
5
5
  class="relative shrink-0"
6
6
  >
7
7
  <PopoverButton
8
- class="p-0.5 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-new-primary"
9
- :class="hasColumnFilter ? 'bg-primary text-white' : 'hover:bg-gray-100'"
8
+ class="flex size-5 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-new-primary"
9
+ :class="open ? 'bg-new-primary/10' : 'hover:bg-gray-100'"
10
10
  >
11
11
  <RiFilterLine
12
- class="size-3.5"
12
+ class="size-4"
13
+ :class="open || hasColumnFilter ? 'text-new-primary' : 'text-gray-low'"
13
14
  aria-hidden="true"
14
15
  />
15
16
  <span class="sr-only">{{ t('Filtrer') }} {{ column }}</span>
@@ -49,7 +50,6 @@
49
50
  :column-profile="columnProfile"
50
51
  :null-percent="nullPercent"
51
52
  :total-lines="totalLines"
52
- :category-badge-styles="categoryBadgeStyles"
53
53
  :boolean-counts="booleanCounts"
54
54
  />
55
55
  </PopoverPanel>
@@ -68,7 +68,7 @@ import { hasFilterForColumn as _hasFilterForColumn } from '../../functions/tabul
68
68
  import BrandedButton from '../BrandedButton.vue'
69
69
  import ClientOnly from '../ClientOnly.vue'
70
70
  import TabularFilterContent from './TabularFilterContent.vue'
71
- import type { TabularColumnProfile, ColumnType, ColumnFilters, SortConfig, BadgeStyle } from './types'
71
+ import type { TabularColumnProfile, ColumnType, ColumnFilters, SortConfig } from './types'
72
72
 
73
73
  const props = defineProps<{
74
74
  column: string
@@ -76,7 +76,6 @@ const props = defineProps<{
76
76
  columnProfile: TabularColumnProfile | null
77
77
  nullPercent: string
78
78
  totalLines: number
79
- categoryBadgeStyles?: Record<string, BadgeStyle>
80
79
  booleanCounts?: { trueCount: number, falseCount: number }
81
80
  }>()
82
81
 
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <BrandedButton
3
+ color="tertiary"
4
+ size="2xs"
5
+ :icon="RiFilterLine"
6
+ keep-margins-even-without-borders
7
+ @click="mobileFilterOpen = true"
8
+ >
9
+ {{ t('Filtres & tri') }}
10
+ </BrandedButton>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { RiFilterLine } from '@remixicon/vue'
15
+ import BrandedButton from '../BrandedButton.vue'
16
+ import { useTranslation } from '../../composables/useTranslation'
17
+ import { useTabularContext } from './useTabularContext'
18
+
19
+ const { t } = useTranslation()
20
+ const { mobileFilterOpen } = useTabularContext()
21
+ </script>
@@ -0,0 +1,150 @@
1
+ <template>
2
+ <TransitionRoot
3
+ :show="mobileFilterOpen"
4
+ as="template"
5
+ >
6
+ <Dialog
7
+ class="relative z-[900]"
8
+ @close="mobileFilterOpen = false"
9
+ >
10
+ <!-- Backdrop -->
11
+ <TransitionChild
12
+ as="template"
13
+ enter="ease-out duration-300"
14
+ enter-from="opacity-0"
15
+ enter-to="opacity-100"
16
+ leave="ease-in duration-200"
17
+ leave-from="opacity-100"
18
+ leave-to="opacity-0"
19
+ >
20
+ <div class="fixed inset-0 bg-black/30" />
21
+ </TransitionChild>
22
+ <!-- Panel -->
23
+ <TransitionChild
24
+ as="template"
25
+ enter="ease-out duration-300"
26
+ enter-from="translate-y-full"
27
+ enter-to="translate-y-0"
28
+ leave="ease-in duration-200"
29
+ leave-from="translate-y-0"
30
+ leave-to="translate-y-full"
31
+ >
32
+ <div class="fixed inset-x-0 bottom-0 max-h-[80vh] flex flex-col bg-white rounded-t-2xl shadow-xl">
33
+ <DialogPanel class="flex flex-col max-h-[80vh]">
34
+ <div class="px-4 pt-4 pb-2 border-b border-gray-default">
35
+ <DialogTitle class="text-sm font-bold">
36
+ {{ t('Filtres & tri par colonne') }}
37
+ </DialogTitle>
38
+ <p class="text-xs text-gray-low">
39
+ {{ allColumns.length }} {{ t('colonnes') }} · {{ activeFilters.length }} {{ t('filtre') }}{{ activeFilters.length !== 1 ? 's' : '' }}
40
+ </p>
41
+ </div>
42
+ <!-- Column list -->
43
+ <div class="flex-1 overflow-y-auto">
44
+ <div
45
+ v-for="col in allColumns"
46
+ :key="col"
47
+ class="border-b border-gray-default last:border-b-0"
48
+ >
49
+ <button
50
+ class="flex items-center gap-2 w-full px-3 py-2.5 text-left"
51
+ :class="hasFilterForColumn(col) ? 'bg-new-primary/5' : ''"
52
+ @click="toggleColumn(col)"
53
+ >
54
+ <component
55
+ :is="getColumnDisplay(col).icon"
56
+ class="size-3.5 text-gray-low shrink-0"
57
+ aria-hidden="true"
58
+ />
59
+ <span class="flex-1 text-sm text-gray-title truncate">{{ col }}</span>
60
+ <RiArrowUpLine
61
+ v-if="sort?.column === col && sort.direction === 'asc'"
62
+ class="size-3 text-new-primary shrink-0"
63
+ aria-hidden="true"
64
+ />
65
+ <RiArrowDownLine
66
+ v-if="sort?.column === col && sort.direction === 'desc'"
67
+ class="size-3 text-new-primary shrink-0"
68
+ aria-hidden="true"
69
+ />
70
+ <span
71
+ v-if="hasFilterForColumn(col)"
72
+ class="size-2 rounded-full bg-new-primary shrink-0"
73
+ />
74
+ <RiArrowDownSLine
75
+ class="size-3.5 text-gray-low shrink-0 transition-transform"
76
+ :class="{ 'rotate-180': expandedCol === col }"
77
+ aria-hidden="true"
78
+ />
79
+ </button>
80
+ <div
81
+ v-if="expandedCol === col"
82
+ class="pb-1"
83
+ >
84
+ <TabularFilterContent
85
+ v-model:sort="sort"
86
+ v-model:filters="filters"
87
+ :column="col"
88
+ :column-type="getColumnType(col)"
89
+ :column-profile="getColumnProfile(col)"
90
+ :null-percent="getNullPercent(col)"
91
+ :total-lines="totalLines"
92
+ :boolean-counts="getColumnType(col) === 'boolean' ? getBooleanCounts(col) : undefined"
93
+ />
94
+ </div>
95
+ </div>
96
+ </div>
97
+ <!-- Reset all -->
98
+ <div
99
+ v-if="activeFilters.length > 0 || sort"
100
+ class="border-t border-gray-default px-4 py-3"
101
+ >
102
+ <BrandedButton
103
+ color="secondary"
104
+ size="xs"
105
+ class="w-full"
106
+ @click="clearAllFilters(); sort = null; mobileFilterOpen = false"
107
+ >
108
+ {{ t('Tout réinitialiser') }}
109
+ </BrandedButton>
110
+ </div>
111
+ </DialogPanel>
112
+ </div>
113
+ </TransitionChild>
114
+ </Dialog>
115
+ </TransitionRoot>
116
+ </template>
117
+
118
+ <script setup lang="ts">
119
+ import { ref } from 'vue'
120
+ import { Dialog, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
121
+ import { RiArrowDownLine, RiArrowDownSLine, RiArrowUpLine } from '@remixicon/vue'
122
+ import BrandedButton from '../BrandedButton.vue'
123
+ import TabularFilterContent from './TabularFilterContent.vue'
124
+ import { useTranslation } from '../../composables/useTranslation'
125
+ import { useTabularContext } from './useTabularContext'
126
+
127
+ const { t } = useTranslation()
128
+ const {
129
+ mobileFilterOpen,
130
+ allColumns,
131
+ activeFilters,
132
+ sort,
133
+ filters,
134
+ hasFilterForColumn,
135
+ clearAllFilters,
136
+ totalLines,
137
+ getColumnDisplay,
138
+ getColumnType,
139
+ getColumnProfile,
140
+ getNullPercent,
141
+ getBooleanCounts,
142
+ } = useTabularContext()
143
+
144
+ // The expanded column is local to the sheet.
145
+ const expandedCol = ref<string | null>(null)
146
+
147
+ function toggleColumn(col: string) {
148
+ expandedCol.value = expandedCol.value === col ? null : col
149
+ }
150
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <span class="flex items-center gap-1.5 text-xs text-gray-plain">
3
+ <RiLoader5Line
4
+ v-if="isRefreshing"
5
+ class="size-3 text-new-primary animate-spin"
6
+ aria-hidden="true"
7
+ />
8
+ <RiLayoutRowLine
9
+ v-else
10
+ class="size-3 text-mention-grey"
11
+ aria-hidden="true"
12
+ />
13
+ <span class="font-bold hidden md:inline">{{ t('Lignes') }}</span>
14
+ <!-- The count stays in place while refreshing: the spinner already says it is
15
+ stale, and swapping it for a word of another width would shift the whole
16
+ toolbar on every search. -->
17
+ <span
18
+ data-testid="row-count"
19
+ class="font-mono tabular-nums"
20
+ >{{ (tableData?.meta.total ?? 0).toLocaleString() }}/{{ totalLines.toLocaleString() }}</span>
21
+ </span>
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ import { RiLayoutRowLine, RiLoader5Line } from '@remixicon/vue'
26
+ import { useTranslation } from '../../composables/useTranslation'
27
+ import { useTabularContext } from './useTabularContext'
28
+
29
+ const { t } = useTranslation()
30
+ const { tableData, totalLines, isRefreshing } = useTabularContext()
31
+ </script>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <!-- Toolbar row — mirrors TabularToolbar: the mobile filter button on the left (it
3
+ only shows below md), and the columns menu (h-6 button, which drives the row
4
+ height) plus the rows info on the right. The active-filters area stays empty
5
+ until the user filters, so nothing stands in for it. -->
6
+ <div class="animate-pulse-placeholder flex shrink-0 items-center gap-2 border-b border-gray-default p-2">
7
+ <div class="h-6 w-24 rounded bg-gray-200 md:hidden" />
8
+ <div class="flex flex-1 items-center justify-end gap-4">
9
+ <div class="h-6 w-24 rounded bg-gray-200" />
10
+ <div class="h-5 w-24 rounded bg-gray-200" />
11
+ </div>
12
+ </div>
13
+
14
+ <!-- Table — mirrors TabularTable: tall header cells (name + type line) then rows.
15
+ Desktop only, like the real one. -->
16
+ <div
17
+ class="animate-pulse-placeholder hidden overflow-hidden md:block"
18
+ :class="fill ? 'min-h-0 flex-1' : 'max-h-[70vh]'"
19
+ role="status"
20
+ :aria-label="t('Chargement de l\'aperçu…')"
21
+ >
22
+ <table class="w-full table-fixed text-sm border-collapse">
23
+ <thead class="bg-gray-some shadow-[inset_0_-1px_0_0_#E5E5E5]">
24
+ <tr class="border-b border-gray-default">
25
+ <th
26
+ v-for="i in 6"
27
+ :key="i"
28
+ class="h-12 px-3 text-left align-middle border-r border-gray-default last:border-r-0"
29
+ >
30
+ <div class="flex items-center justify-between gap-1">
31
+ <div class="flex items-center gap-1">
32
+ <div class="size-4 shrink-0 rounded bg-gray-200" />
33
+ <div class="h-3.5 w-20 rounded bg-gray-200" />
34
+ </div>
35
+ <div class="size-4 shrink-0 rounded bg-gray-200" />
36
+ </div>
37
+ </th>
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ <tr
42
+ v-for="row in 16"
43
+ :key="row"
44
+ class="h-10 border-b border-gray-default even:bg-gray-lowest-2"
45
+ >
46
+ <td
47
+ v-for="col in 6"
48
+ :key="col"
49
+ class="px-2 align-middle border-r border-gray-default last:border-r-0"
50
+ >
51
+ <div class="h-3.5 w-3/4 rounded bg-gray-200" />
52
+ </td>
53
+ </tr>
54
+ </tbody>
55
+ </table>
56
+ </div>
57
+
58
+ <!-- Mobile — the real table becomes a list of cards below md, each showing four
59
+ fields until it is expanded. -->
60
+ <div
61
+ class="animate-pulse-placeholder space-y-2 px-1 md:hidden"
62
+ role="status"
63
+ :aria-label="t('Chargement de l\'aperçu…')"
64
+ >
65
+ <div
66
+ v-for="card in 4"
67
+ :key="card"
68
+ class="space-y-2 rounded-lg border border-gray-default p-3"
69
+ :class="card % 2 === 0 ? 'bg-gray-lowest-2' : 'bg-white'"
70
+ >
71
+ <div
72
+ v-for="field in 4"
73
+ :key="field"
74
+ class="flex flex-col gap-0.5"
75
+ >
76
+ <div class="h-3 w-24 rounded bg-gray-200" />
77
+ <div class="h-4 w-2/3 rounded bg-gray-200" />
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </template>
82
+
83
+ <script setup lang="ts">
84
+ import { useTranslation } from '../../composables/useTranslation'
85
+
86
+ defineProps<{
87
+ // Fill the available height (fullscreen) instead of the default capped height.
88
+ fill?: boolean
89
+ }>()
90
+
91
+ const { t } = useTranslation()
92
+ </script>