mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
77 lines
1.8 KiB
Vue
77 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import { DatePicker as VCalendarDatePicker } from 'v-calendar'
|
|
import 'v-calendar/dist/style.css'
|
|
|
|
const props = defineProps({
|
|
modelValue: {
|
|
type: Date,
|
|
default: null
|
|
}
|
|
})
|
|
|
|
const emit = defineEmits(['update:model-value', 'close'])
|
|
|
|
const colorMode = useColorMode()
|
|
|
|
const isDark = computed(() => colorMode.value === 'dark')
|
|
|
|
const date = computed({
|
|
get: () => props.modelValue,
|
|
set: (value) => {
|
|
emit('update:model-value', value)
|
|
emit('close')
|
|
}
|
|
})
|
|
|
|
const attrs = [{
|
|
key: 'today',
|
|
highlight: {
|
|
color: 'blue',
|
|
fillMode: 'outline',
|
|
class: '!bg-gray-100 dark:!bg-gray-800'
|
|
},
|
|
dates: new Date()
|
|
}]
|
|
</script>
|
|
|
|
<template>
|
|
<VCalendarDatePicker
|
|
v-model="date"
|
|
transparent
|
|
borderless
|
|
:attributes="attrs"
|
|
:is-dark="isDark"
|
|
title-position="left"
|
|
trim-weeks
|
|
:first-day-of-week="2"
|
|
/>
|
|
</template>
|
|
|
|
<style>
|
|
:root {
|
|
--vc-gray-50: rgb(var(--color-gray-50));
|
|
--vc-gray-100: rgb(var(--color-gray-100));
|
|
--vc-gray-200: rgb(var(--color-gray-200));
|
|
--vc-gray-300: rgb(var(--color-gray-300));
|
|
--vc-gray-400: rgb(var(--color-gray-400));
|
|
--vc-gray-500: rgb(var(--color-gray-500));
|
|
--vc-gray-600: rgb(var(--color-gray-600));
|
|
--vc-gray-700: rgb(var(--color-gray-700));
|
|
--vc-gray-800: rgb(var(--color-gray-800));
|
|
--vc-gray-900: rgb(var(--color-gray-900));
|
|
}
|
|
|
|
.vc-blue {
|
|
--vc-accent-50: rgb(var(--color-primary-50));
|
|
--vc-accent-100: rgb(var(--color-primary-100));
|
|
--vc-accent-200: rgb(var(--color-primary-200));
|
|
--vc-accent-300: rgb(var(--color-primary-300));
|
|
--vc-accent-400: rgb(var(--color-primary-400));
|
|
--vc-accent-500: rgb(var(--color-primary-500));
|
|
--vc-accent-600: rgb(var(--color-primary-600));
|
|
--vc-accent-700: rgb(var(--color-primary-700));
|
|
--vc-accent-800: rgb(var(--color-primary-800));
|
|
--vc-accent-900: rgb(var(--color-primary-900));
|
|
}
|
|
</style>
|