Skip to content

Commit ba3cb39

Browse files
feat: add UI components including Input, Label, Switch, Checkbox, Skeleton, Textarea, Separator, ScrollArea, ToggleGroup, Tabs, Tooltip, and more (#8)
1 parent 1fda778 commit ba3cb39

File tree

128 files changed

+3048
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3048
-0
lines changed

app/components/ui/badge/Badge.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script setup lang="ts">
2+
import type { PrimitiveProps } from 'reka-ui'
3+
import { cn } from '@/lib/utils'
4+
import { Primitive } from 'reka-ui'
5+
import { computed, type HTMLAttributes } from 'vue'
6+
import { type BadgeVariants, badgeVariants } from '.'
7+
8+
const props = defineProps<PrimitiveProps & {
9+
variant?: BadgeVariants['variant']
10+
class?: HTMLAttributes['class']
11+
}>()
12+
13+
const delegatedProps = computed(() => {
14+
const { class: _, ...delegated } = props
15+
16+
return delegated
17+
})
18+
</script>
19+
20+
<template>
21+
<Primitive
22+
data-slot="badge"
23+
:class="cn(badgeVariants({ variant }), props.class)"
24+
v-bind="delegatedProps"
25+
>
26+
<slot />
27+
</Primitive>
28+
</template>

app/components/ui/badge/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { cva, type VariantProps } from 'class-variance-authority'
2+
3+
export { default as Badge } from './Badge.vue'
4+
5+
export const badgeVariants = cva(
6+
'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden',
7+
{
8+
variants: {
9+
variant: {
10+
default:
11+
'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
12+
secondary:
13+
'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
14+
destructive:
15+
'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
16+
outline:
17+
'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
18+
},
19+
},
20+
defaultVariants: {
21+
variant: 'default',
22+
},
23+
},
24+
)
25+
export type BadgeVariants = VariantProps<typeof badgeVariants>

app/components/ui/card/Card.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="card"
13+
:class="
14+
cn(
15+
'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
16+
props.class,
17+
)
18+
"
19+
>
20+
<slot />
21+
</div>
22+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="card-action"
13+
:class="cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', props.class)"
14+
>
15+
<slot />
16+
</div>
17+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="card-content"
13+
:class="cn('px-6', props.class)"
14+
>
15+
<slot />
16+
</div>
17+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<p
12+
data-slot="card-description"
13+
:class="cn('text-muted-foreground text-sm', props.class)"
14+
>
15+
<slot />
16+
</p>
17+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="card-footer"
13+
:class="cn('flex items-center px-6 [.border-t]:pt-6', props.class)"
14+
>
15+
<slot />
16+
</div>
17+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="card-header"
13+
:class="cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', props.class)"
14+
>
15+
<slot />
16+
</div>
17+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@/lib/utils'
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes['class']
7+
}>()
8+
</script>
9+
10+
<template>
11+
<h3
12+
data-slot="card-title"
13+
:class="cn('leading-none font-semibold', props.class)"
14+
>
15+
<slot />
16+
</h3>
17+
</template>

app/components/ui/card/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export { default as Card } from './Card.vue'
2+
export { default as CardAction } from './CardAction.vue'
3+
export { default as CardContent } from './CardContent.vue'
4+
export { default as CardDescription } from './CardDescription.vue'
5+
export { default as CardFooter } from './CardFooter.vue'
6+
export { default as CardHeader } from './CardHeader.vue'
7+
export { default as CardTitle } from './CardTitle.vue'

0 commit comments

Comments
 (0)