@datagouv/components-next 1.0.2-dev.89 → 1.0.2-dev.90

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 { c as Ke } from "./main-DWYesZBr.js";
1
+ import { c as Ke } from "./main-Dk_66g-3.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": "1.0.2-dev.89",
3
+ "version": "1.0.2-dev.90",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -13,6 +13,7 @@
13
13
  <SearchInput
14
14
  v-model="q"
15
15
  :placeholder="resolvedPlaceholder"
16
+ :auto-focus
16
17
  />
17
18
  </div>
18
19
  <div class="grid grid-cols-12 mt-2 md:mt-5">
@@ -401,11 +402,17 @@ const props = withDefaults(defineProps<{
401
402
  config?: GlobalSearchConfig
402
403
  placeholder?: string | null
403
404
  hideSearchInput?: boolean
405
+ autoFocus?: boolean
404
406
  }>(), {
405
407
  config: getDefaultGlobalSearchConfig,
406
408
  hideSearchInput: false,
409
+ autoFocus: true,
407
410
  })
408
411
 
412
+ const emit = defineEmits<{
413
+ resultsCount: [total: number]
414
+ }>()
415
+
409
416
  // defineModel's default is static and can't depend on props, so we cast and initialize manually
410
417
  const currentType = defineModel<string>('type') as Ref<string>
411
418
  if (!currentType.value) currentType.value = configKey(props.config[0] ?? { class: 'datasets' })
@@ -717,6 +724,10 @@ function resetFilters() {
717
724
  const searchResults = computed(() => resultsMap[currentType.value]?.data.value)
718
725
  const searchResultsStatus = computed(() => resultsMap[currentType.value]?.status.value)
719
726
 
727
+ watch(searchResults, (results) => {
728
+ if (results) emit('resultsCount', results.total)
729
+ }, { immediate: true })
730
+
720
731
  // RSS feed URL for datasets
721
732
  const rssUrl = computed(() => {
722
733
  if (currentTypeConfig.value?.class !== 'datasets') return null
@@ -37,7 +37,7 @@ import BrandedButton from '../BrandedButton.vue'
37
37
 
38
38
  const q = defineModel<string>({ required: true })
39
39
 
40
- withDefaults(defineProps<{
40
+ const props = withDefaults(defineProps<{
41
41
  placeholder?: string | null
42
42
  autoFocus?: boolean
43
43
  }>(), {
@@ -57,6 +57,7 @@ const focus = () => {
57
57
  }
58
58
 
59
59
  onMounted(async () => {
60
+ if (!props.autoFocus) return
60
61
  await nextTick()
61
62
  focus()
62
63
  })