feat(InputDate): new component (#5387) · nuxt/ui@dabc4f8

1+

<script setup lang="ts">

2+

import { CalendarDate } from '@internationalized/date'

3+

import theme from '#build/ui/input-date'

4+5+

const colors = Object.keys(theme.variants.color)

6+

const variants = Object.keys(theme.variants.variant)

7+

const sizes = Object.keys(theme.variants.size)

8+9+

const attrs = reactive({

10+

color: [theme.defaultVariants.color],

11+

variant: [theme.defaultVariants.variant],

12+

size: [theme.defaultVariants.size]

13+

})

14+15+

const value = shallowRef(new CalendarDate(2022, 1, 10))

16+

const range = shallowRef({

17+

start: new CalendarDate(2022, 1, 10),

18+

end: new CalendarDate(2022, 1, 20)

19+

})

20+

</script>

21+22+

<template>

23+

<Navbar>

24+

<USelect v-model="attrs.color" :items="colors" multiple />

25+

<USelect v-model="attrs.variant" :items="variants" multiple />

26+

<USelect v-model="attrs.size" :items="sizes" multiple />

27+

</Navbar>

28+29+

<Matrix v-slot="props" :attrs="attrs">

30+

<UInputDate v-model="value" autofocus v-bind="props" />

31+

<UInputDate :default-value="new CalendarDate(2022, 1, 10)" v-bind="props" />

32+

<UInputDate v-model="range" range v-bind="props" />

33+

<UInputDate :default-value="{ start: new CalendarDate(2022, 1, 10), end: new CalendarDate(2022, 1, 20) }" range v-bind="props" />

34+

<UInputDate highlight v-bind="props" />

35+

<UInputDate disabled v-bind="props" />

36+

<UInputDate required v-bind="props" />

37+

<UInputDate icon="i-lucide-clock" v-bind="props" />

38+

<UInputDate icon="i-lucide-clock" trailing v-bind="props" />

39+

<UInputDate :avatar="{ src: 'https://github.com/benjamincanac.png' }" icon="i-lucide-clock" trailing v-bind="props" />

40+

<UInputDate loading v-bind="props" />

41+

<UInputDate loading trailing v-bind="props" />

42+

<UInputDate loading icon="i-lucide-clock" trailing-icon="i-lucide-chevron-down" v-bind="props" />

43+

</Matrix>

44+

</template>