-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
531 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script setup lang="ts"> | ||
import type { HTMLAttributes } from 'vue' | ||
import { Primitive, type PrimitiveProps } from 'radix-vue' | ||
import { type ButtonVariants, buttonVariants } from '.' | ||
import { cn } from '@/lib/utils' | ||
interface Props extends PrimitiveProps { | ||
variant?: ButtonVariants['variant'] | ||
size?: ButtonVariants['size'] | ||
class?: HTMLAttributes['class'] | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
as: 'button', | ||
}) | ||
</script> | ||
|
||
<template> | ||
<Primitive | ||
:as="as" | ||
:as-child="asChild" | ||
:class="cn(buttonVariants({ variant, size }), props.class)" | ||
> | ||
<slot /> | ||
</Primitive> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { type VariantProps, cva } from 'class-variance-authority' | ||
|
||
export { default as Button } from './Button.vue' | ||
|
||
export const buttonVariants = cva( | ||
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', | ||
{ | ||
variants: { | ||
variant: { | ||
default: 'bg-primary text-primary-foreground hover:bg-primary/90', | ||
destructive: | ||
'bg-destructive text-destructive-foreground hover:bg-destructive/90', | ||
outline: | ||
'border border-input bg-background hover:bg-accent hover:text-accent-foreground', | ||
secondary: | ||
'bg-secondary text-secondary-foreground hover:bg-secondary/80', | ||
ghost: 'hover:bg-accent hover:text-accent-foreground', | ||
link: 'text-primary underline-offset-4 hover:underline', | ||
}, | ||
size: { | ||
default: 'h-10 px-4 py-2', | ||
xs: 'h-7 rounded px-2', | ||
sm: 'h-9 rounded-md px-3', | ||
lg: 'h-11 rounded-md px-8', | ||
icon: 'h-10 w-10', | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'default', | ||
size: 'default', | ||
}, | ||
}, | ||
) | ||
|
||
export type ButtonVariants = VariantProps<typeof buttonVariants> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
test-frontend/src/components/ui/shadcn/calendar/Calendar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarRoot, type CalendarRootEmits, type CalendarRootProps, useForwardPropsEmits } from 'radix-vue' | ||
import { CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarHeader, CalendarHeading, CalendarNextButton, CalendarPrevButton } from './index.ts' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarRootProps & { class?: HTMLAttributes['class'] }>() | ||
const emits = defineEmits<CalendarRootEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<CalendarRoot | ||
v-slot="{ grid, weekDays }" | ||
:class="cn('p-3', props.class)" | ||
v-bind="forwarded" | ||
> | ||
<CalendarHeader> | ||
<CalendarPrevButton /> | ||
<CalendarHeading /> | ||
<CalendarNextButton /> | ||
</CalendarHeader> | ||
|
||
<div class="flex flex-col gap-y-4 mt-4 sm:flex-row sm:gap-x-4 sm:gap-y-0"> | ||
<CalendarGrid v-for="month in grid" :key="month.value.toString()"> | ||
<CalendarGridHead> | ||
<CalendarGridRow> | ||
<CalendarHeadCell | ||
v-for="day in weekDays" :key="day" | ||
> | ||
{{ day }} | ||
</CalendarHeadCell> | ||
</CalendarGridRow> | ||
</CalendarGridHead> | ||
<CalendarGridBody> | ||
<CalendarGridRow v-for="(weekDates, index) in month.rows" :key="`weekDate-${index}`" class="mt-2 w-full"> | ||
<CalendarCell | ||
v-for="weekDate in weekDates" | ||
:key="weekDate.toString()" | ||
:date="weekDate" | ||
> | ||
<CalendarCellTrigger | ||
:day="weekDate" | ||
:month="month.value" | ||
/> | ||
</CalendarCell> | ||
</CalendarGridRow> | ||
</CalendarGridBody> | ||
</CalendarGrid> | ||
</div> | ||
</CalendarRoot> | ||
</template> |
24 changes: 24 additions & 0 deletions
24
test-frontend/src/components/ui/shadcn/calendar/CalendarCell.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarCell, type CalendarCellProps, useForwardProps } from 'radix-vue' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarCellProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<CalendarCell | ||
:class="cn('relative h-9 w-9 p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([data-selected])]:rounded-md [&:has([data-selected])]:bg-accent [&:has([data-selected][data-outside-month])]:bg-accent/50', props.class)" | ||
v-bind="forwardedProps" | ||
> | ||
<slot /> | ||
</CalendarCell> | ||
</template> |
38 changes: 38 additions & 0 deletions
38
test-frontend/src/components/ui/shadcn/calendar/CalendarCellTrigger.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarCellTrigger, type CalendarCellTriggerProps, useForwardProps } from 'radix-vue' | ||
import { buttonVariants } from '@/components/ui/button' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarCellTriggerProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<CalendarCellTrigger | ||
:class="cn( | ||
buttonVariants({ variant: 'ghost' }), | ||
'h-9 w-9 p-0 font-normal', | ||
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground', | ||
// Selected | ||
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:opacity-100 data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground', | ||
// Disabled | ||
'data-[disabled]:text-muted-foreground data-[disabled]:opacity-50', | ||
// Unavailable | ||
'data-[unavailable]:text-destructive-foreground data-[unavailable]:line-through', | ||
// Outside months | ||
'data-[outside-month]:pointer-events-none data-[outside-month]:text-muted-foreground data-[outside-month]:opacity-50 [&[data-outside-month][data-selected]]:bg-accent/50 [&[data-outside-month][data-selected]]:text-muted-foreground [&[data-outside-month][data-selected]]:opacity-30', | ||
props.class, | ||
)" | ||
v-bind="forwardedProps" | ||
> | ||
<slot /> | ||
</CalendarCellTrigger> | ||
</template> |
24 changes: 24 additions & 0 deletions
24
test-frontend/src/components/ui/shadcn/calendar/CalendarGrid.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarGrid, type CalendarGridProps, useForwardProps } from 'radix-vue' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarGridProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<CalendarGrid | ||
:class="cn('w-full border-collapse space-y-1', props.class)" | ||
v-bind="forwardedProps" | ||
> | ||
<slot /> | ||
</CalendarGrid> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
test-frontend/src/components/ui/shadcn/calendar/CalendarGridBody.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script lang="ts" setup> | ||
import { CalendarGridBody, type CalendarGridBodyProps } from 'radix-vue' | ||
const props = defineProps<CalendarGridBodyProps>() | ||
</script> | ||
|
||
<template> | ||
<CalendarGridBody v-bind="props"> | ||
<slot /> | ||
</CalendarGridBody> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
test-frontend/src/components/ui/shadcn/calendar/CalendarGridHead.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script lang="ts" setup> | ||
import { CalendarGridHead, type CalendarGridHeadProps } from 'radix-vue' | ||
const props = defineProps<CalendarGridHeadProps>() | ||
</script> | ||
|
||
<template> | ||
<CalendarGridHead v-bind="props"> | ||
<slot /> | ||
</CalendarGridHead> | ||
</template> |
21 changes: 21 additions & 0 deletions
21
test-frontend/src/components/ui/shadcn/calendar/CalendarGridRow.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarGridRow, type CalendarGridRowProps, useForwardProps } from 'radix-vue' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarGridRowProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<CalendarGridRow :class="cn('flex', props.class)" v-bind="forwardedProps"> | ||
<slot /> | ||
</CalendarGridRow> | ||
</template> |
21 changes: 21 additions & 0 deletions
21
test-frontend/src/components/ui/shadcn/calendar/CalendarHeadCell.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts" setup> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { CalendarHeadCell, type CalendarHeadCellProps, useForwardProps } from 'radix-vue' | ||
import { cn } from '@/lib/utils.ts' | ||
const props = defineProps<CalendarHeadCellProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<CalendarHeadCell :class="cn('w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground', props.class)" v-bind="forwardedProps"> | ||
<slot /> | ||
</CalendarHeadCell> | ||
</template> |
Oops, something went wrong.