From 03e1fcebb84032deb00868c35d9eba0cc48f4ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Marius=20L=C3=B8set?= Date: Sat, 21 Oct 2023 04:56:41 +0200 Subject: [PATCH] fix: add v-bind="$attrs" to DatePicker in Calendar (#117) * fix: add v-bind="$attrs" to calendar * fix: `inheritAttrs` false, remove duplicated `nextTick` --------- Co-authored-by: Sadegh Barati --- .../registry/default/ui/calendar/Calendar.vue | 18 +++++++++++++++--- .../registry/new-york/ui/calendar/Calendar.vue | 16 ++++++++++++++-- .../registry/styles/default/calendar.json | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue index 78f15c80..e90acfb6 100644 --- a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue @@ -7,7 +7,11 @@ import { computed, nextTick, onMounted, ref } from 'vue' import { buttonVariants } from '../button' import { cn } from '@/lib/utils' -const props = withDefaults(defineProps< { +defineOptions({ + inheritAttrs: false, +}) + +const props = withDefaults(defineProps<{ modelValue?: string | number | Date | Partial<{ start: Date end: Date @@ -41,7 +45,6 @@ function handleNav(direction: 'prev' | 'next') { } onMounted(async () => { - await nextTick() await nextTick() if (modelValue.value instanceof Date && calendarRef.value) calendarRef.value.focusDate(modelValue.value) @@ -59,7 +62,16 @@ onMounted(async () => { - + diff --git a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue index 7ca169ad..899ebccd 100644 --- a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue @@ -7,6 +7,10 @@ import { computed, nextTick, onMounted, ref } from 'vue' import { buttonVariants } from '../button' import { cn } from '@/lib/utils' +defineOptions({ + inheritAttrs: false, +}) + const props = withDefaults(defineProps< { modelValue?: string | number | Date | Partial<{ start: Date @@ -41,7 +45,6 @@ function handleNav(direction: 'prev' | 'next') { } onMounted(async () => { - await nextTick() await nextTick() if (modelValue.value instanceof Date && calendarRef.value) calendarRef.value.focusDate(modelValue.value) @@ -59,7 +62,16 @@ onMounted(async () => { - + diff --git a/apps/www/src/public/registry/styles/default/calendar.json b/apps/www/src/public/registry/styles/default/calendar.json index 81f3016e..01afbeb9 100644 --- a/apps/www/src/public/registry/styles/default/calendar.json +++ b/apps/www/src/public/registry/styles/default/calendar.json @@ -9,7 +9,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts",