Merge https://github.com/selemondev/shadcn-vue into dev
This commit is contained in:
commit
be80b29e2d
4
.github/workflows/publish.yaml
vendored
4
.github/workflows/publish.yaml
vendored
|
|
@ -2,9 +2,13 @@ name: Publish www
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- 'apps/www/**'
|
- 'apps/www/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- 'apps/www/**'
|
- 'apps/www/**'
|
||||||
|
|
||||||
|
|
|
||||||
52
.github/workflows/test.yaml
vendored
Normal file
52
.github/workflows/test.yaml
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
paths:
|
||||||
|
- 'packages/**'
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
paths:
|
||||||
|
- 'packages/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
name: Install pnpm
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
name: Setup pnpm cache
|
||||||
|
with:
|
||||||
|
path: ${{ env.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm i --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: pnpm test
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,6 +7,7 @@ yarn-error.log*
|
||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
|
.nuxt
|
||||||
.env
|
.env
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
60
apps/www/.vitepress/theme/components/CustomizerCode.vue
Normal file
60
apps/www/.vitepress/theme/components/CustomizerCode.vue
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
import { useConfigStore } from '@/stores/config'
|
||||||
|
import { themes } from '@/lib/registry'
|
||||||
|
import { Button } from '@/lib/registry/new-york/ui/button'
|
||||||
|
import CheckIcon from '~icons/radix-icons/check'
|
||||||
|
import CopyIcon from '~icons/radix-icons/copy'
|
||||||
|
|
||||||
|
const { theme, config } = useConfigStore()
|
||||||
|
|
||||||
|
const activeTheme = computed(() => themes.find(i => i.name === theme.value))
|
||||||
|
|
||||||
|
const { copy, copied } = useClipboard()
|
||||||
|
|
||||||
|
const codeRef = ref<HTMLElement>()
|
||||||
|
async function copyCode() {
|
||||||
|
await copy(codeRef.value?.innerText ?? '')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="relative">
|
||||||
|
<pre class="max-h-[450px] overflow-x-auto rounded-lg border bg-zinc-950 !py-0 dark:bg-zinc-900">
|
||||||
|
<code ref="codeRef" class="relative block rounded font-mono text-sm">
|
||||||
|
<span class="line">@layer base {</span>
|
||||||
|
<span class="line">:root {</span>
|
||||||
|
<span class="line"> --background: {{ activeTheme?.cssVars.light.background }};</span>
|
||||||
|
<span class="line"> --foreground: {{ activeTheme?.cssVars.light.foreground }};</span>
|
||||||
|
<template v-for="prefix in (['card', 'popover', 'primary', 'secondary', 'muted', 'accent', 'destructive'] as const)" :key="prefix">
|
||||||
|
<span class="line">--{{ prefix }}: {{ activeTheme?.cssVars.light[prefix] }};</span>
|
||||||
|
<span class="line">--{{ prefix }}-foreground: {{ activeTheme?.cssVars.light[ `${prefix}-foreground`] }};</span>
|
||||||
|
</template>
|
||||||
|
<span class="line"> --border:{{ activeTheme?.cssVars.light.border }};</span>
|
||||||
|
<span class="line"> --input:{{ activeTheme?.cssVars.light.input }};</span>
|
||||||
|
<span class="line"> --ring:{{ activeTheme?.cssVars.light.ring }};</span>
|
||||||
|
<span class="line"> --radius: {{ config.radius }}rem;</span>
|
||||||
|
<span class="line">}</span>
|
||||||
|
<span class="line"> </span>
|
||||||
|
<span class="line">.dark {</span>
|
||||||
|
<span class="line"> --background:{{ activeTheme?.cssVars.dark.background }};</span>
|
||||||
|
<span class="line"> --foreground:{{ activeTheme?.cssVars.dark.foreground }};</span>
|
||||||
|
<template v-for="prefix in (['card', 'popover', 'primary', 'secondary', 'muted', 'accent', 'destructive'] as const)" :key="prefix">
|
||||||
|
<span class="line">--{{ prefix }}:{{ activeTheme?.cssVars.dark[ prefix] }};</span>
|
||||||
|
<span class="line">--{{ prefix }}-foreground:{{ activeTheme?.cssVars.dark[ `${prefix}-foreground`] }};</span>
|
||||||
|
</template>
|
||||||
|
<span class="line"> --border:{{ activeTheme?.cssVars.dark.border }};</span>
|
||||||
|
<span class="line"> --input:{{ activeTheme?.cssVars.dark.input }};</span>
|
||||||
|
<span class="line"> --ring:{{ activeTheme?.cssVars.dark.ring }};</span>
|
||||||
|
<span class="line">}</span>
|
||||||
|
<span class="line">}</span>
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
<Button size="sm" class="absolute right-4 top-4 bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground" @click="copyCode">
|
||||||
|
<CheckIcon v-if="copied" class="mr-2 h-4 w-4" />
|
||||||
|
<CopyIcon v-else class="mr-2 h-4 w-4" />
|
||||||
|
{{ copied ? 'Copied' : 'Copy' }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -19,12 +19,11 @@ import DashboardExample from '@/examples/dashboard/Example.vue'
|
||||||
href="/docs/changelog"
|
href="/docs/changelog"
|
||||||
class="inline-flex items-center rounded-lg bg-muted px-3 py-1 text-sm font-medium"
|
class="inline-flex items-center rounded-lg bg-muted px-3 py-1 text-sm font-medium"
|
||||||
>
|
>
|
||||||
🎉 <Separator class="mx-2 h-4" orientation="vertical" />
|
🚧 <Separator class="mx-2 h-4" orientation="vertical" />
|
||||||
<span class="sm:hidden">Style, a new CLI and more.</span>
|
<span class="sm:hidden">WIP</span>
|
||||||
<span class="hidden sm:inline">
|
<span class="hidden sm:inline">WIP
|
||||||
Introducing Style, a new CLI and more.
|
|
||||||
</span>
|
</span>
|
||||||
<ArrowRightIcon class="ml-1 h-4 w-4" />
|
<!-- <ArrowRightIcon class="ml-1 h-4 w-4" /> -->
|
||||||
</a>
|
</a>
|
||||||
<PageHeaderHeading>Build your component library.</PageHeaderHeading>
|
<PageHeaderHeading>Build your component library.</PageHeaderHeading>
|
||||||
<PageHeaderDescription>
|
<PageHeaderDescription>
|
||||||
|
|
|
||||||
9
apps/www/.vitepress/theme/components/LinkedCard.vue
Normal file
9
apps/www/.vitepress/theme/components/LinkedCard.vue
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<a :class="cn('flex w-full flex-col items-center rounded-xl border bg-card p-6 text-card-foreground shadow transition-colors hover:bg-muted/50 sm:p-10', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
|
@ -42,6 +42,9 @@ function getHeadingsWithHierarchy(divId: string) {
|
||||||
else if (level === 3 && currentLevel?.items) {
|
else if (level === 3 && currentLevel?.items) {
|
||||||
currentLevel.items.push(item)
|
currentLevel.items.push(item)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
hierarchy.items.push(item)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return hierarchy
|
return hierarchy
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
export { default as ComponentPreview } from './ComponentPreview.vue'
|
export { default as ComponentPreview } from './ComponentPreview.vue'
|
||||||
export { default as Callout } from './Callout.vue'
|
export { default as Callout } from './Callout.vue'
|
||||||
|
export { default as LinkedCard } from './LinkedCard.vue'
|
||||||
export { default as ManualInstall } from './ManualInstall.vue'
|
export { default as ManualInstall } from './ManualInstall.vue'
|
||||||
export { default as Steps } from './Steps.vue'
|
export { default as Steps } from './Steps.vue'
|
||||||
export { default as VPImage } from './VPImage.vue'
|
export { default as VPImage } from './VPImage.vue'
|
||||||
|
|
|
||||||
|
|
@ -376,30 +376,24 @@ const range = ref({
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div
|
<div
|
||||||
class="flex w-max max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm bg-secondary"
|
class="flex w-auto max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm bg-muted"
|
||||||
>
|
>
|
||||||
<p class="text-foreground">
|
Hi, how can I help you today?
|
||||||
Hi There!, I'm Bear, the founder of Bear Studios. I'm here
|
|
||||||
to help you with anything you need.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex w-max max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm ml-auto bg-primary text-primary-foreground"
|
class="flex w-auto max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm ml-auto bg-primary text-primary-foreground"
|
||||||
>
|
>
|
||||||
<p>Hey, I'm having trouble with my account.</p>
|
Hey, I'm having trouble with my account.
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex w-max max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm bg-secondary"
|
class="flex w-auto max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm bg-muted"
|
||||||
>
|
>
|
||||||
<p class="text-foreground">
|
Sure, I can help you with that. What seems to be the problem?
|
||||||
Sure, I can help you with that. What seems to be the
|
|
||||||
problem?
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex w-max max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm ml-auto bg-primary text-primary-foreground"
|
class="flex w-auto max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm ml-auto bg-primary text-primary-foreground"
|
||||||
>
|
>
|
||||||
<p>I can't log in.</p>
|
I can't log in.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,31 @@ export const docsConfig: DocsConfig = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Installation',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
title: 'Vite',
|
||||||
|
href: '/docs/installation/vite',
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Nuxt',
|
||||||
|
href: '/docs/installation/nuxt',
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: 'Astro',
|
||||||
|
// href: '/docs/installation/astro',
|
||||||
|
// items: [],
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: 'Laravel',
|
||||||
|
href: '/docs/installation/laravel',
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Components',
|
title: 'Components',
|
||||||
items: [
|
items: [
|
||||||
|
|
@ -155,18 +180,16 @@ export const docsConfig: DocsConfig = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Combobox',
|
title: 'Combobox',
|
||||||
disabled: true,
|
href: '/docs/components/combobox',
|
||||||
label: 'Soon',
|
label: 'New',
|
||||||
href: '#',
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Command',
|
||||||
|
href: '/docs/components/command',
|
||||||
|
label: 'New',
|
||||||
items: [],
|
items: [],
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// title: "Command",
|
|
||||||
// href: "#",
|
|
||||||
// label: "Soon",
|
|
||||||
// disabled: true,
|
|
||||||
// items: []
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
title: 'Context Menu',
|
title: 'Context Menu',
|
||||||
href: '/docs/components/context-menu',
|
href: '/docs/components/context-menu',
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useData } from 'vitepress'
|
||||||
import PageHeader from '../components/PageHeader.vue'
|
import PageHeader from '../components/PageHeader.vue'
|
||||||
import PageHeaderHeading from '../components/PageHeaderHeading.vue'
|
import PageHeaderHeading from '../components/PageHeaderHeading.vue'
|
||||||
import PageHeaderDescription from '../components/PageHeaderDescription.vue'
|
import PageHeaderDescription from '../components/PageHeaderDescription.vue'
|
||||||
|
import CustomizerCode from '../components/CustomizerCode.vue'
|
||||||
import { RADII, useConfigStore } from '@/stores/config'
|
import { RADII, useConfigStore } from '@/stores/config'
|
||||||
import { colors } from '@/lib/registry'
|
import { colors } from '@/lib/registry'
|
||||||
import { Button } from '@/lib/registry/new-york/ui/button'
|
import { Button } from '@/lib/registry/new-york/ui/button'
|
||||||
|
|
@ -231,6 +232,7 @@ watch(radius, (radius) => {
|
||||||
Copy and paste the following code into your CSS file.
|
Copy and paste the following code into your CSS file.
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
<CustomizerCode />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,20 @@ export const Index = {
|
||||||
component: () => import('../src/lib/registry/default/example/CollapsibleDemo.vue').then(m => m.default),
|
component: () => import('../src/lib/registry/default/example/CollapsibleDemo.vue').then(m => m.default),
|
||||||
files: ['../src/lib/registry/default/example/CollapsibleDemo.vue'],
|
files: ['../src/lib/registry/default/example/CollapsibleDemo.vue'],
|
||||||
},
|
},
|
||||||
|
ComboboxDemo: {
|
||||||
|
name: 'ComboboxDemo',
|
||||||
|
type: 'components:example',
|
||||||
|
registryDependencies: ['utils', 'button', 'command', 'popover'],
|
||||||
|
component: () => import('../src/lib/registry/default/example/ComboboxDemo.vue').then(m => m.default),
|
||||||
|
files: ['../src/lib/registry/default/example/ComboboxDemo.vue'],
|
||||||
|
},
|
||||||
|
CommandDemo: {
|
||||||
|
name: 'CommandDemo',
|
||||||
|
type: 'components:example',
|
||||||
|
registryDependencies: ['command'],
|
||||||
|
component: () => import('../src/lib/registry/default/example/CommandDemo.vue').then(m => m.default),
|
||||||
|
files: ['../src/lib/registry/default/example/CommandDemo.vue'],
|
||||||
|
},
|
||||||
ContextMenuDemo: {
|
ContextMenuDemo: {
|
||||||
name: 'ContextMenuDemo',
|
name: 'ContextMenuDemo',
|
||||||
type: 'components:example',
|
type: 'components:example',
|
||||||
|
|
@ -466,6 +480,20 @@ export const Index = {
|
||||||
component: () => import('../src/lib/registry/new-york/example/CollapsibleDemo.vue').then(m => m.default),
|
component: () => import('../src/lib/registry/new-york/example/CollapsibleDemo.vue').then(m => m.default),
|
||||||
files: ['../src/lib/registry/new-york/example/CollapsibleDemo.vue'],
|
files: ['../src/lib/registry/new-york/example/CollapsibleDemo.vue'],
|
||||||
},
|
},
|
||||||
|
ComboboxDemo: {
|
||||||
|
name: 'ComboboxDemo',
|
||||||
|
type: 'components:example',
|
||||||
|
registryDependencies: ['utils', 'button', 'command', 'popover'],
|
||||||
|
component: () => import('../src/lib/registry/new-york/example/ComboboxDemo.vue').then(m => m.default),
|
||||||
|
files: ['../src/lib/registry/new-york/example/ComboboxDemo.vue'],
|
||||||
|
},
|
||||||
|
CommandDemo: {
|
||||||
|
name: 'CommandDemo',
|
||||||
|
type: 'components:example',
|
||||||
|
registryDependencies: ['command'],
|
||||||
|
component: () => import('../src/lib/registry/new-york/example/CommandDemo.vue').then(m => m.default),
|
||||||
|
files: ['../src/lib/registry/new-york/example/CommandDemo.vue'],
|
||||||
|
},
|
||||||
ContextMenuDemo: {
|
ContextMenuDemo: {
|
||||||
name: 'ContextMenuDemo',
|
name: 'ContextMenuDemo',
|
||||||
type: 'components:example',
|
type: 'components:example',
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@morev/vue-transitions": "^2.3.6",
|
"@morev/vue-transitions": "^2.3.6",
|
||||||
"@tanstack/vue-table": "^8.9.8",
|
"@tanstack/vue-table": "^8.9.9",
|
||||||
"@unovis/ts": "^1.2.1",
|
"@unovis/ts": "^1.2.1",
|
||||||
"@vueuse/core": "^10.4.1",
|
"@vueuse/core": "^10.4.1",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
|
|
@ -32,22 +32,22 @@
|
||||||
"@iconify/json": "^2.2.108",
|
"@iconify/json": "^2.2.108",
|
||||||
"@iconify/vue": "^4.1.1",
|
"@iconify/vue": "^4.1.1",
|
||||||
"@types/lodash.template": "^4.5.1",
|
"@types/lodash.template": "^4.5.1",
|
||||||
"@types/node": "^20.5.7",
|
"@types/node": "^20.6.0",
|
||||||
"@vitejs/plugin-vue": "^4.3.4",
|
"@vitejs/plugin-vue": "^4.3.4",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
||||||
"@vue/compiler-core": "^3.3.4",
|
"@vue/compiler-core": "^3.3.4",
|
||||||
"@vue/compiler-dom": "^3.3.4",
|
"@vue/compiler-dom": "^3.3.4",
|
||||||
"autoprefixer": "^10.4.15",
|
"autoprefixer": "^10.4.15",
|
||||||
"lodash.template": "^4.5.0",
|
"lodash.template": "^4.5.0",
|
||||||
"radix-vue": "^0.1.34",
|
"radix-vue": "^0.2.2",
|
||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
"tailwind-merge": "^1.14.0",
|
"tailwind-merge": "^1.14.0",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"tsx": "^3.12.8",
|
"tsx": "^3.12.10",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"unplugin-icons": "^0.17.0",
|
"unplugin-icons": "^0.17.0",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.9",
|
||||||
"vitepress": "^1.0.0-rc.12",
|
"vitepress": "^1.0.0-rc.13",
|
||||||
"vue-tsc": "^1.8.10"
|
"vue-tsc": "^1.8.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ You will be asked a few questions to configure `components.json`:
|
||||||
|
|
||||||
```txt:line-numbers
|
```txt:line-numbers
|
||||||
Would you like to use TypeScript (recommended)? no / yes
|
Would you like to use TypeScript (recommended)? no / yes
|
||||||
Which framework are you using? Vite + Vue / Nuxt
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
Which style would you like to use? › Default
|
Which style would you like to use? › Default
|
||||||
Which color would you like to use as base color? › Slate
|
Which color would you like to use as base color? › Slate
|
||||||
Where is your global CSS file? › › src/index.css
|
Where is your global CSS file? › › src/index.css
|
||||||
|
|
@ -25,7 +25,6 @@ Do you want to use CSS variables for colors? › no / yes
|
||||||
Where is your tailwind.config.js located? › tailwind.config.js
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
Configure the import alias for components: › @/components
|
Configure the import alias for components: › @/components
|
||||||
Configure the import alias for utils: › @/lib/utils
|
Configure the import alias for utils: › @/lib/utils
|
||||||
Are you using React Server Components? › no / yes (no)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
|
||||||
89
apps/www/src/content/docs/components/combobox.md
Normal file
89
apps/www/src/content/docs/components/combobox.md
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
---
|
||||||
|
title: Combobox
|
||||||
|
description: Autocomplete input and command palette with a list of suggestions.
|
||||||
|
component: true
|
||||||
|
---
|
||||||
|
|
||||||
|
<ComponentPreview name="ComboboxDemo" />
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The Combobox is built using a composition of the `<Popover />` and the `<Command />` components.
|
||||||
|
|
||||||
|
See installation instructions for the [Popover](/docs/components/popover#installation) and the [Command](/docs/components/command#installation) components.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Check, ChevronsUpDown } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/lib/registry/default/ui/button'
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
} from '@/lib/registry/default/ui/command'
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@/lib/registry/default/ui/popover'
|
||||||
|
|
||||||
|
const frameworks = [
|
||||||
|
{ value: 'next.js', label: 'Next.js' },
|
||||||
|
{ value: 'sveltekit', label: 'SvelteKit' },
|
||||||
|
{ value: 'nuxt.js', label: 'Nuxt.js' },
|
||||||
|
{ value: 'remix', label: 'Remix' },
|
||||||
|
{ value: 'astro', label: 'Astro' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const open = ref(false)
|
||||||
|
const value = ref({})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Popover v-model:open="open">
|
||||||
|
<PopoverTrigger as-child>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
:aria-expanded="open"
|
||||||
|
class="w-[200px] justify-between"
|
||||||
|
>
|
||||||
|
{{ value ? frameworks.find((framework) => framework.value === value)?.label : 'Select framework...' }}
|
||||||
|
|
||||||
|
<ChevronsUpDown class="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent class="w-[200px] p-0">
|
||||||
|
<Command v-model="value">
|
||||||
|
<CommandInput placeholder="Search framework..." />
|
||||||
|
<CommandEmpty>No framework found.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
<CommandItem
|
||||||
|
v-for="framework in frameworks"
|
||||||
|
:key="framework.value"
|
||||||
|
:value="framework"
|
||||||
|
@select="open = false"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
:class="cn(
|
||||||
|
'mr-2 h-4 w-4',
|
||||||
|
value === framework.value ? 'opacity-100' : 'opacity-0',
|
||||||
|
)"
|
||||||
|
/>
|
||||||
|
{{ framework.label }}
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
65
apps/www/src/content/docs/components/command.md
Normal file
65
apps/www/src/content/docs/components/command.md
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
---
|
||||||
|
title: Command
|
||||||
|
description: Displays a list of options for the user to pick from—triggered by a button.
|
||||||
|
source: apps/www/src/lib/registry/default/ui/popover
|
||||||
|
primitive: https://www.radix-vue.com/components/popover.html
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
<ComponentPreview name="CommandDemo" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest add command
|
||||||
|
```
|
||||||
|
|
||||||
|
<ManualInstall>
|
||||||
|
|
||||||
|
1. Install `radix-vue`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install radix-vue
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copy and paste the component source files linked at the top of this page into your project.
|
||||||
|
</ManualInstall>
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandDialog,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
CommandList,
|
||||||
|
CommandSeparator,
|
||||||
|
CommandShortcut,
|
||||||
|
} from '@/components/ui/command'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="Type a command or search..." />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty>No results found.</CommandEmpty>
|
||||||
|
<CommandGroup heading="Suggestions">
|
||||||
|
<CommandItem>Calendar</CommandItem>
|
||||||
|
<CommandItem>Search Emoji</CommandItem>
|
||||||
|
<CommandItem>Calculator</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
<CommandSeparator />
|
||||||
|
<CommandGroup heading="Settings">
|
||||||
|
<CommandItem>Profile</CommandItem>
|
||||||
|
<CommandItem>Billing</CommandItem>
|
||||||
|
<CommandItem>Settings</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</template>```
|
||||||
|
|
@ -3,127 +3,93 @@ title: Installation
|
||||||
description: How to install dependencies and structure your app.
|
description: How to install dependencies and structure your app.
|
||||||
---
|
---
|
||||||
|
|
||||||
<script setup>
|
## Frameworks
|
||||||
import { Alert, AlertDescription } from "@/lib/registry/default/ui/alert";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
Unlike the original [shadcn/ui](https://ui.shadcn.com) for React, where the full components can exist in a single file, components in this port are split into multiple files due to majority vote from [Vue community](https://twitter.com/zernonia/status/1694351679540580524) to use `SFC` rather than `h()` render function or `JSX`, so utilizing the CLI to add components will be the optimal approach.
|
<div class="grid sm:grid-cols-2 gap-4 mt-8 sm:gap-6 not-docs">
|
||||||
|
<LinkedCard href="/docs/installation/vite">
|
||||||
|
<svg
|
||||||
|
role="img"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="w-10 h-10"
|
||||||
|
fill="currentColor"
|
||||||
|
>
|
||||||
|
<title>Vite</title>
|
||||||
|
<path d="m8.286 10.578.512-8.657a.306.306 0 0 1 .247-.282L17.377.006a.306.306 0 0 1 .353.385l-1.558 5.403a.306.306 0 0 0 .352.385l2.388-.46a.306.306 0 0 1 .332.438l-6.79 13.55-.123.19a.294.294 0 0 1-.252.14c-.177 0-.35-.152-.305-.369l1.095-5.301a.306.306 0 0 0-.388-.355l-1.433.435a.306.306 0 0 1-.389-.354l.69-3.375a.306.306 0 0 0-.37-.36l-2.32.536a.306.306 0 0 1-.374-.316zm14.976-7.926L17.284 3.74l-.544 1.887 2.077-.4a.8.8 0 0 1 .84.369.8.8 0 0 1 .034.783L12.9 19.93l-.013.025-.015.023-.122.19a.801.801 0 0 1-.672.37.826.826 0 0 1-.634-.302.8.8 0 0 1-.16-.67l1.029-4.981-1.12.34a.81.81 0 0 1-.86-.262.802.802 0 0 1-.165-.67l.63-3.08-2.027.468a.808.808 0 0 1-.768-.233.81.81 0 0 1-.217-.6l.389-6.57-7.44-1.33a.612.612 0 0 0-.64.906L11.58 23.691a.612.612 0 0 0 1.066-.004l11.26-20.135a.612.612 0 0 0-.644-.9z" />
|
||||||
|
</svg>
|
||||||
|
<p class="font-medium mt-2">Vite</p>
|
||||||
|
</LinkedCard>
|
||||||
|
<LinkedCard href="/docs/installation/nuxt">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-12 h-12" viewBox="0 0 900 900" fill="none">
|
||||||
|
<title>Nuxt</title>
|
||||||
|
<path d="M504.908 750H839.476C850.103 750.001 860.542 747.229 869.745 741.963C878.948 736.696 886.589 729.121 891.9 719.999C897.211 710.876 900.005 700.529 900 689.997C899.995 679.465 897.193 669.12 891.873 660.002L667.187 274.289C661.876 265.169 654.237 257.595 645.036 252.329C635.835 247.064 625.398 244.291 614.773 244.291C604.149 244.291 593.711 247.064 584.511 252.329C575.31 257.595 567.67 265.169 562.36 274.289L504.908 372.979L392.581 179.993C387.266 170.874 379.623 163.301 370.42 158.036C361.216 152.772 350.777 150 340.151 150C329.525 150 319.086 152.772 309.883 158.036C300.679 163.301 293.036 170.874 287.721 179.993L8.12649 660.002C2.80743 669.12 0.00462935 679.465 5.72978e-06 689.997C-0.00461789 700.529 2.78909 710.876 8.10015 719.999C13.4112 729.121 21.0523 736.696 30.255 741.963C39.4576 747.229 49.8973 750.001 60.524 750H270.538C353.748 750 415.112 713.775 457.336 643.101L559.849 467.145L614.757 372.979L779.547 655.834H559.849L504.908 750ZM267.114 655.737L120.551 655.704L340.249 278.586L449.87 467.145L376.474 593.175C348.433 639.03 316.577 655.737 267.114 655.737Z" fill="white"/>
|
||||||
|
</svg>
|
||||||
|
<p class="font-medium mt-2">Nuxt</p>
|
||||||
|
</LinkedCard>
|
||||||
|
<!-- <LinkedCard href="/docs/installation/astro">
|
||||||
|
<svg
|
||||||
|
role="img"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="w-10 h-10"
|
||||||
|
fill="currentColor"
|
||||||
|
>
|
||||||
|
<title>Astro</title>
|
||||||
|
<path
|
||||||
|
d="M16.074 16.86C15.354 17.476 13.917 17.895 12.262 17.895C10.23 17.895 8.527 17.263 8.075 16.412C7.914 16.9 7.877 17.458 7.877 17.814C7.877 17.814 7.771 19.564 8.988 20.782C8.988 20.15 9.501 19.637 10.133 19.637C11.216 19.637 11.215 20.582 11.214 21.349V21.418C11.214 22.582 11.925 23.579 12.937 24C12.7812 23.6794 12.7005 23.3275 12.701 22.971C12.701 21.861 13.353 21.448 14.111 20.968C14.713 20.585 15.383 20.161 15.844 19.308C16.0926 18.8493 16.2225 18.3357 16.222 17.814C16.2221 17.4903 16.1722 17.1685 16.074 16.86ZM15.551 0.6C15.747 0.844 15.847 1.172 16.047 1.829L20.415 16.176C18.7743 15.3246 17.0134 14.7284 15.193 14.408L12.35 4.8C12.3273 4.72337 12.2803 4.65616 12.2162 4.60844C12.152 4.56072 12.0742 4.53505 11.9943 4.53528C11.9143 4.5355 11.8366 4.56161 11.7727 4.60969C11.7089 4.65777 11.6623 4.72524 11.64 4.802L8.83 14.405C7.00149 14.724 5.23264 15.3213 3.585 16.176L7.974 1.827C8.174 1.171 8.274 0.843 8.471 0.6C8.64406 0.385433 8.86922 0.218799 9.125 0.116C9.415 0 9.757 0 10.443 0H13.578C14.264 0 14.608 0 14.898 0.117C15.1529 0.219851 15.3783 0.386105 15.551 0.6Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<p class="font-medium mt-2">Astro</p>
|
||||||
|
</LinkedCard> -->
|
||||||
|
<LinkedCard href="/docs/installation/laravel">
|
||||||
|
<svg
|
||||||
|
role="img"
|
||||||
|
viewBox="0 0 62 65"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="w-10 h-10"
|
||||||
|
>
|
||||||
|
<path d="M61.8548 14.6253C61.8778 14.7102 61.8895 14.7978 61.8897 14.8858V28.5615C61.8898 28.737 61.8434 28.9095 61.7554 29.0614C61.6675 29.2132 61.5409 29.3392 61.3887 29.4265L49.9104 36.0351V49.1337C49.9104 49.4902 49.7209 49.8192 49.4118 49.9987L25.4519 63.7916C25.3971 63.8227 25.3372 63.8427 25.2774 63.8639C25.255 63.8714 25.2338 63.8851 25.2101 63.8913C25.0426 63.9354 24.8666 63.9354 24.6991 63.8913C24.6716 63.8838 24.6467 63.8689 24.6205 63.8589C24.5657 63.8389 24.5084 63.8215 24.456 63.7916L0.501061 49.9987C0.348882 49.9113 0.222437 49.7853 0.134469 49.6334C0.0465019 49.4816 0.000120578 49.3092 0 49.1337L0 8.10652C0 8.01678 0.0124642 7.92953 0.0348998 7.84477C0.0423783 7.8161 0.0598282 7.78993 0.0697995 7.76126C0.0884958 7.70891 0.105946 7.65531 0.133367 7.6067C0.152063 7.5743 0.179485 7.54812 0.20192 7.51821C0.230588 7.47832 0.256763 7.43719 0.290416 7.40229C0.319084 7.37362 0.356476 7.35243 0.388883 7.32751C0.425029 7.29759 0.457436 7.26518 0.498568 7.2415L12.4779 0.345059C12.6296 0.257786 12.8015 0.211853 12.9765 0.211853C13.1515 0.211853 13.3234 0.257786 13.475 0.345059L25.4531 7.2415H25.4556C25.4955 7.26643 25.5292 7.29759 25.5653 7.32626C25.5977 7.35119 25.6339 7.37362 25.6625 7.40104C25.6974 7.43719 25.7224 7.47832 25.7523 7.51821C25.7735 7.54812 25.8021 7.5743 25.8196 7.6067C25.8483 7.65656 25.8645 7.70891 25.8844 7.76126C25.8944 7.78993 25.9118 7.8161 25.9193 7.84602C25.9423 7.93096 25.954 8.01853 25.9542 8.10652V33.7317L35.9355 27.9844V14.8846C35.9355 14.7973 35.948 14.7088 35.9704 14.6253C35.9792 14.5954 35.9954 14.5692 36.0053 14.5405C36.0253 14.4882 36.0427 14.4346 36.0702 14.386C36.0888 14.3536 36.1163 14.3274 36.1375 14.2975C36.1674 14.2576 36.1923 14.2165 36.2272 14.1816C36.2559 14.1529 36.292 14.1317 36.3244 14.1068C36.3618 14.0769 36.3942 14.0445 36.4341 14.0208L48.4147 7.12434C48.5663 7.03694 48.7383 6.99094 48.9133 6.99094C49.0883 6.99094 49.2602 7.03694 49.4118 7.12434L61.3899 14.0208C61.4323 14.0457 61.4647 14.0769 61.5021 14.1055C61.5333 14.1305 61.5694 14.1529 61.5981 14.1803C61.633 14.2165 61.6579 14.2576 61.6878 14.2975C61.7103 14.3274 61.7377 14.3536 61.7551 14.386C61.7838 14.4346 61.8 14.4882 61.8199 14.5405C61.8312 14.5692 61.8474 14.5954 61.8548 14.6253ZM59.893 27.9844V16.6121L55.7013 19.0252L49.9104 22.3593V33.7317L59.8942 27.9844H59.893ZM47.9149 48.5566V37.1768L42.2187 40.4299L25.953 49.7133V61.2003L47.9149 48.5566ZM1.99677 9.83281V48.5566L23.9562 61.199V49.7145L12.4841 43.2219L12.4804 43.2194L12.4754 43.2169C12.4368 43.1945 12.4044 43.1621 12.3682 43.1347C12.3371 43.1097 12.3009 43.0898 12.2735 43.0624L12.271 43.0586C12.2386 43.0275 12.2162 42.9888 12.1887 42.9539C12.1638 42.9203 12.1339 42.8916 12.114 42.8567L12.1127 42.853C12.0903 42.8156 12.0766 42.7707 12.0604 42.7283C12.0442 42.6909 12.023 42.656 12.013 42.6161C12.0005 42.5688 11.998 42.5177 11.9931 42.4691C11.9881 42.4317 11.9781 42.3943 11.9781 42.3569V15.5801L6.18848 12.2446L1.99677 9.83281ZM12.9777 2.36177L2.99764 8.10652L12.9752 13.8513L22.9541 8.10527L12.9752 2.36177H12.9777ZM18.1678 38.2138L23.9574 34.8809V9.83281L19.7657 12.2459L13.9749 15.5801V40.6281L18.1678 38.2138ZM48.9133 9.14105L38.9344 14.8858L48.9133 20.6305L58.8909 14.8846L48.9133 9.14105ZM47.9149 22.3593L42.124 19.0252L37.9323 16.6121V27.9844L43.7219 31.3174L47.9149 33.7317V22.3593ZM24.9533 47.987L39.59 39.631L46.9065 35.4555L36.9352 29.7145L25.4544 36.3242L14.9907 42.3482L24.9533 47.987Z" />
|
||||||
|
</svg>
|
||||||
|
<p class="font-medium mt-2">Laravel</p>
|
||||||
|
</LinkedCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The CLI will create a folder for _each_ component, which will sometimes just contain a single Vue file, and in other times, multiple files. Within each folder, there will be an `index.ts` file that exports the component(s), so you can import them from a single file.
|
## TypeScript
|
||||||
|
|
||||||
For example, the Accordion component is split into four `.vue` files:
|
This project and the components are written in TypeScript. We recommend using TypeScript for your project as well.
|
||||||
|
|
||||||
- `Accordion.vue`
|
However we provide a JavaScript version of the components as well. The JavaScript version is available via the [cli](/docs/cli).
|
||||||
- `AccordionContent.vue`
|
|
||||||
- `AccordionItem.vue`
|
|
||||||
- `AccordionTrigger.vue`
|
|
||||||
|
|
||||||
They can then be imported from the `accordion/index.ts` file like so:
|
To opt-out of TypeScript, you can use the `typescript` flag in your `components.json` file.
|
||||||
|
|
||||||
```ts
|
```json {9} title="components.json"
|
||||||
import * as Accordion from '@/components/ui/accordion'
|
|
||||||
|
|
||||||
// or
|
|
||||||
import {
|
|
||||||
Accordion,
|
|
||||||
AccordionContent,
|
|
||||||
AccordionItem,
|
|
||||||
AccordionTrigger
|
|
||||||
} from '@/components/ui/accordion'
|
|
||||||
```
|
|
||||||
|
|
||||||
Regardless of the import approach you take, the components will be tree-shaken by Rollup, so you don't have to worry about unused components being bundled into your app.
|
|
||||||
|
|
||||||
## New Project
|
|
||||||
|
|
||||||
<Steps>
|
|
||||||
|
|
||||||
### Create project
|
|
||||||
|
|
||||||
Use the Vue CLI to create a new project.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm create vue@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
### Add Tailwind and its configuration
|
|
||||||
|
|
||||||
Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and `postcss.config.js` files:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install -D tailwindcss postcss autoprefixer
|
|
||||||
|
|
||||||
npx tailwindcss init -p
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run the CLI
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx shadcn-vue@latest init
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configure components.json
|
|
||||||
|
|
||||||
You will be asked a few questions to configure `components.json`:
|
|
||||||
|
|
||||||
```txt:line-numbers
|
|
||||||
Would you like to use TypeScript (recommended)? no / yes
|
|
||||||
Which framework are you using? Vite + Vue / Nuxt
|
|
||||||
Which style would you like to use? › Default
|
|
||||||
Which color would you like to use as base color? › Slate
|
|
||||||
Where is your global CSS file? › › src/index.css
|
|
||||||
Do you want to use CSS variables for colors? › no / yes
|
|
||||||
Where is your tailwind.config.js located? › tailwind.config.js
|
|
||||||
Configure the import alias for components: › @/components
|
|
||||||
Configure the import alias for utils: › @/lib/utils
|
|
||||||
Are you using React Server Components? › no / yes (no)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Edit tsconfig.json
|
|
||||||
|
|
||||||
By default your `tsconfig.json` for new project should be configured nicely. However, make sure the code below is added in the compilerOptions of your tsconfig.json so your app can resolve paths without error
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"style": "default",
|
||||||
"baseUrl": ".",
|
"tailwind": {
|
||||||
"paths": {
|
"config": "tailwind.config.js",
|
||||||
"@/*": ["./src/*"]
|
"css": "src/app/globals.css",
|
||||||
}
|
"baseColor": "zinc",
|
||||||
|
"cssVariables": true
|
||||||
|
},
|
||||||
|
"typescript": false,
|
||||||
|
"aliases": {
|
||||||
|
"utils": "~/lib/utils",
|
||||||
|
"components": "~/components"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To configure import aliases, you can use the following `jsconfig.json`:
|
||||||
|
|
||||||
### That's it
|
```json {4} title="jsconfig.json"
|
||||||
|
{
|
||||||
You can now start adding components to your project.
|
"compilerOptions": {
|
||||||
|
"paths": {
|
||||||
```bash
|
"@/*": ["./*"]
|
||||||
npx shadcn-vue@latest add button
|
}
|
||||||
```
|
}
|
||||||
|
}
|
||||||
The command above will add the `Button` component to your project. You can then import it like this:
|
|
||||||
|
|
||||||
```vue {2,7}
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { Button } from '@/components/ui/button'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<Button>Click me</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
```
|
|
||||||
|
|
||||||
</Steps>
|
|
||||||
|
|
||||||
149
apps/www/src/content/docs/installation/astro.md
Normal file
149
apps/www/src/content/docs/installation/astro.md
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
---
|
||||||
|
title: Astro
|
||||||
|
description: Install and configure Astro.
|
||||||
|
---
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
|
||||||
|
### Create project
|
||||||
|
|
||||||
|
Start by creating a new Astro project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm create astro@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure your Astro project
|
||||||
|
|
||||||
|
You will be asked a few questions to configure your project:
|
||||||
|
|
||||||
|
```txt showLineNumbers
|
||||||
|
- Where should we create your new project?
|
||||||
|
./your-app-name
|
||||||
|
- How would you like to start your new project?
|
||||||
|
Choose a starter template (or Empty)
|
||||||
|
- Install dependencies?
|
||||||
|
Yes
|
||||||
|
- Do you plan to write TypeScript?
|
||||||
|
Yes
|
||||||
|
- How strict should TypeScript be?
|
||||||
|
Strict
|
||||||
|
- Initialize a new git repository? (optional)
|
||||||
|
Yes/No
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add React to your project
|
||||||
|
|
||||||
|
Install React using the Astro CLI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx astro add react
|
||||||
|
```
|
||||||
|
|
||||||
|
<Callout className="mt-4">
|
||||||
|
|
||||||
|
Answer `Yes` to all the question prompted by the CLI when installing React.
|
||||||
|
|
||||||
|
</Callout>
|
||||||
|
|
||||||
|
### Add Tailwind CSS to your project
|
||||||
|
|
||||||
|
Install Tailwind CSS using the Astro CLI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx astro add tailwind
|
||||||
|
```
|
||||||
|
|
||||||
|
<Callout className="mt-4">
|
||||||
|
|
||||||
|
Answer `Yes` to all the question prompted by the CLI when installing Tailwind CSS.
|
||||||
|
|
||||||
|
</Callout>
|
||||||
|
|
||||||
|
### Edit tsconfig.json file
|
||||||
|
|
||||||
|
Add the code below to the tsconfig.json file to resolve paths:
|
||||||
|
|
||||||
|
```json {2-7} showLineNumbers
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the CLI
|
||||||
|
|
||||||
|
Run the `shadcn-ui` init command to setup your project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-ui@latest init
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure components.json
|
||||||
|
|
||||||
|
You will be asked a few questions to configure `components.json`:
|
||||||
|
|
||||||
|
```txt showLineNumbers
|
||||||
|
Would you like to use TypeScript (recommended)? no / yes
|
||||||
|
Which style would you like to use? › Default
|
||||||
|
Which color would you like to use as base color? › Slate
|
||||||
|
Where is your global CSS file? › › ./src/styles/globals.css
|
||||||
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
|
Where is your tailwind.config.js located? › tailwind.config.cjs
|
||||||
|
Configure the import alias for components: › @/components
|
||||||
|
Configure the import alias for utils: › @/lib/utils
|
||||||
|
Are you using React Server Components? › no
|
||||||
|
```
|
||||||
|
|
||||||
|
### Import the globals.css file
|
||||||
|
|
||||||
|
Import the `globals.css` file in the `src/index.astro` file:
|
||||||
|
|
||||||
|
```ts {2} showLineNumbers
|
||||||
|
import '@/styles/globals.css'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update astro tailwind config
|
||||||
|
|
||||||
|
To prevent serving the Tailwind base styles twice, we need to tell Astro not to apply the base styles, since we already include them in our own `globals.css` file. To do this, set the `applyBaseStyles` config option for the tailwind plugin in `astro.config.mjs` to `false`.
|
||||||
|
|
||||||
|
```ts {3-5} showLineNumbers
|
||||||
|
export default defineConfig({
|
||||||
|
integrations: [
|
||||||
|
tailwind({
|
||||||
|
applyBaseStyles: false,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### That's it
|
||||||
|
|
||||||
|
You can now start adding components to your project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-ui@latest add button
|
||||||
|
```
|
||||||
|
|
||||||
|
The command above will add the `Button` component to your project. You can then import it like this:
|
||||||
|
|
||||||
|
```astro {2,10} showLineNumbers
|
||||||
|
---
|
||||||
|
import { Button } from "@/components/ui/button"
|
||||||
|
---
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Astro</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<Button>Hello World</Button>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
</Steps>
|
||||||
153
apps/www/src/content/docs/installation/laravel.md
Normal file
153
apps/www/src/content/docs/installation/laravel.md
Normal file
|
|
@ -0,0 +1,153 @@
|
||||||
|
---
|
||||||
|
title: Laravel
|
||||||
|
description: Install and configure Laravel with Inertia
|
||||||
|
---
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
|
||||||
|
### Create project
|
||||||
|
|
||||||
|
Start by creating a new Laravel project with Inertia and Vue using the Laravel installer `laravel new my-app`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laravel new my-app --typescript --breeze --stack=vue --git --no-interaction
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the CLI
|
||||||
|
|
||||||
|
Run the `shadcn-vue` init command to setup your project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest init
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure components.json
|
||||||
|
|
||||||
|
You will be asked a few questions to configure `components.json`:
|
||||||
|
|
||||||
|
```txt showLineNumbers
|
||||||
|
Would you like to use TypeScript (recommended)? no / yes
|
||||||
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
|
Which style would you like to use? › Default
|
||||||
|
Which color would you like to use as base color? › Slate
|
||||||
|
Where is your global CSS file? › resources/css/app.css
|
||||||
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
Configure the import alias for components: › @/Components
|
||||||
|
Configure the import alias for utils: › @/lib/utils
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update tailwind.config.js
|
||||||
|
|
||||||
|
The `shadcn-vue` CLI will automatically overwrite your `tailwind.config.js`. Update it to look like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import forms from '@tailwindcss/forms'
|
||||||
|
import defaultTheme from 'tailwindcss/defaultTheme'
|
||||||
|
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
darkMode: 'class',
|
||||||
|
content: [
|
||||||
|
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
|
||||||
|
'./storage/framework/views/*.php',
|
||||||
|
'./resources/views/**/*.blade.php',
|
||||||
|
'./resources/js/**/*.tsx',
|
||||||
|
],
|
||||||
|
|
||||||
|
theme: {
|
||||||
|
container: {
|
||||||
|
center: true,
|
||||||
|
padding: '2rem',
|
||||||
|
screens: {
|
||||||
|
'2xl': '1400px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
border: 'hsl(var(--border))',
|
||||||
|
input: 'hsl(var(--input))',
|
||||||
|
ring: 'hsl(var(--ring))',
|
||||||
|
background: 'hsl(var(--background))',
|
||||||
|
foreground: 'hsl(var(--foreground))',
|
||||||
|
primary: {
|
||||||
|
DEFAULT: 'hsl(var(--primary))',
|
||||||
|
foreground: 'hsl(var(--primary-foreground))',
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
DEFAULT: 'hsl(var(--secondary))',
|
||||||
|
foreground: 'hsl(var(--secondary-foreground))',
|
||||||
|
},
|
||||||
|
destructive: {
|
||||||
|
DEFAULT: 'hsl(var(--destructive))',
|
||||||
|
foreground: 'hsl(var(--destructive-foreground))',
|
||||||
|
},
|
||||||
|
muted: {
|
||||||
|
DEFAULT: 'hsl(var(--muted))',
|
||||||
|
foreground: 'hsl(var(--muted-foreground))',
|
||||||
|
},
|
||||||
|
accent: {
|
||||||
|
DEFAULT: 'hsl(var(--accent))',
|
||||||
|
foreground: 'hsl(var(--accent-foreground))',
|
||||||
|
},
|
||||||
|
popover: {
|
||||||
|
DEFAULT: 'hsl(var(--popover))',
|
||||||
|
foreground: 'hsl(var(--popover-foreground))',
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
DEFAULT: 'hsl(var(--card))',
|
||||||
|
foreground: 'hsl(var(--card-foreground))',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
borderRadius: {
|
||||||
|
lg: 'var(--radius)',
|
||||||
|
md: 'calc(var(--radius) - 2px)',
|
||||||
|
sm: 'calc(var(--radius) - 4px)',
|
||||||
|
},
|
||||||
|
fontFamily: {
|
||||||
|
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
|
||||||
|
},
|
||||||
|
keyframes: {
|
||||||
|
'accordion-down': {
|
||||||
|
from: { height: 0 },
|
||||||
|
to: { height: 'var(--radix-accordion-content-height)' },
|
||||||
|
},
|
||||||
|
'accordion-up': {
|
||||||
|
from: { height: 'var(--radix-accordion-content-height)' },
|
||||||
|
to: { height: 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
animation: {
|
||||||
|
'accordion-down': 'accordion-down 0.2s ease-out',
|
||||||
|
'accordion-up': 'accordion-up 0.2s ease-out',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [forms, require('tailwindcss-animate')],
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### That's it
|
||||||
|
|
||||||
|
You can now start adding components to your project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest add button
|
||||||
|
```
|
||||||
|
|
||||||
|
The command above will add the `Button` component to your project. You can then import it like this:
|
||||||
|
|
||||||
|
```vue {2,7}
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Button } from '@/Components/ui/button'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Button>Click me</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
</Steps>
|
||||||
124
apps/www/src/content/docs/installation/nuxt.md
Normal file
124
apps/www/src/content/docs/installation/nuxt.md
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
---
|
||||||
|
title: Nuxt
|
||||||
|
description: Install and configure Nuxt.
|
||||||
|
---
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
|
||||||
|
### Create project
|
||||||
|
|
||||||
|
Start by creating a new Nuxt project using `create-next-app`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx nuxi@latest init my-app
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install TailwindCSS module
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -D @nuxtjs/tailwindcss
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure `nuxt.config.ts`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export default defineNuxtConfig({
|
||||||
|
modules: ['@nuxtjs/tailwindcss'],
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
path: '~/components/ui',
|
||||||
|
// this is required else Nuxt will autoImport `.ts` file
|
||||||
|
extensions: ['.vue'],
|
||||||
|
// prefix for your components, eg: UiButton
|
||||||
|
prefix: 'Ui'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Run the CLI
|
||||||
|
|
||||||
|
Run the `shadcn-vue` init command to setup your project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest init
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure components.json
|
||||||
|
|
||||||
|
You will be asked a few questions to configure `components.json`:
|
||||||
|
|
||||||
|
```txt showLineNumbers
|
||||||
|
Would you like to use TypeScript (recommended)? no / yes
|
||||||
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
|
Which style would you like to use? › Default
|
||||||
|
Which color would you like to use as base color? › Slate
|
||||||
|
Where is your global CSS file? › › src/index.css
|
||||||
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
Configure the import alias for components: › @/components
|
||||||
|
Configure the import alias for utils: › @/lib/utils
|
||||||
|
```
|
||||||
|
|
||||||
|
### App structure
|
||||||
|
|
||||||
|
Here's the default structure of Nuxt app. You can use this as a reference:
|
||||||
|
|
||||||
|
```txt {6-16,20-21}
|
||||||
|
.
|
||||||
|
├── pages
|
||||||
|
│ ├── index.vue
|
||||||
|
│ └── dashboard.vue
|
||||||
|
├── components
|
||||||
|
│ ├── ui
|
||||||
|
│ │ ├── alert-dialog
|
||||||
|
│ │ │ ├── AlertDialog.vue
|
||||||
|
│ │ │ └── ...
|
||||||
|
│ │ ├── button
|
||||||
|
│ │ │ ├── Button.vue
|
||||||
|
│ │ │ └── ...
|
||||||
|
│ │ ├── dropdown-menu
|
||||||
|
│ │ │ ├── Dropdown.vue
|
||||||
|
│ │ │ └── ...
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── MainNav.vue
|
||||||
|
│ ├── PageHeader.vue
|
||||||
|
│ └── ...
|
||||||
|
├── lib
|
||||||
|
│ └── utils.ts
|
||||||
|
├── assets
|
||||||
|
│ ├── css
|
||||||
|
│ │ └── tailwind.css
|
||||||
|
├── app.vue
|
||||||
|
├── nuxt.config.ts
|
||||||
|
├── package.json
|
||||||
|
├── tailwind.config.js
|
||||||
|
└── tsconfig.json
|
||||||
|
```
|
||||||
|
|
||||||
|
- I place the UI components in the `components/ui` folder.
|
||||||
|
- The rest of the components such as `<PageHeader />` and `<MainNav />` are placed in the `components` folder.
|
||||||
|
- The `lib` folder contains all the utility functions. I have a `utils.ts` where I define the `cn` helper.
|
||||||
|
- The `assets/css` folder contains the global CSS.
|
||||||
|
|
||||||
|
### That's it
|
||||||
|
|
||||||
|
You can now start adding components to your project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest add button
|
||||||
|
```
|
||||||
|
|
||||||
|
The command above will add the `Button` component to your project. Nuxt autoImport will handle importing the components, you can just use it as such:
|
||||||
|
|
||||||
|
```vue {3}
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<UiButton>Click me</UiButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
</Steps>
|
||||||
106
apps/www/src/content/docs/installation/vite.md
Normal file
106
apps/www/src/content/docs/installation/vite.md
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
---
|
||||||
|
title: Vite
|
||||||
|
description: Install and configure Vite.
|
||||||
|
---
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
|
||||||
|
### Create project
|
||||||
|
|
||||||
|
Start by creating a new Vue project using `vite`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm 6.x
|
||||||
|
npm create vite@latest my-vue-app --template vue
|
||||||
|
|
||||||
|
# npm 7+, extra double-dash is needed:
|
||||||
|
npm create vite@latest my-vue-app -- --template vue
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add Tailwind and its configuration
|
||||||
|
|
||||||
|
Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and `postcss.config.js` files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -D tailwindcss postcss autoprefixer
|
||||||
|
|
||||||
|
npx tailwindcss init -p
|
||||||
|
```
|
||||||
|
|
||||||
|
### Edit tsconfig.json
|
||||||
|
|
||||||
|
Add the code below to the compilerOptions of your tsconfig.json so your app can resolve paths without error
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update vite.config.ts
|
||||||
|
|
||||||
|
Add the code below to the vite.config.ts so your app can resolve paths without error
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import path from "path"
|
||||||
|
import vue from "@vitejs/plugin-vue"
|
||||||
|
import { defineConfig } from "vite"
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": path.resolve(__dirname, "./src"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the CLI
|
||||||
|
|
||||||
|
Run the `shadcn-vue` init command to setup your project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest init
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure components.json
|
||||||
|
|
||||||
|
You will be asked a few questions to configure `components.json`:
|
||||||
|
|
||||||
|
```txt showLineNumbers
|
||||||
|
Would you like to use TypeScript (recommended)? no / yes
|
||||||
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
|
Which style would you like to use? › Default
|
||||||
|
Which color would you like to use as base color? › Slate
|
||||||
|
Where is your global CSS file? › › src/index.css
|
||||||
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
Configure the import alias for components: › @/components
|
||||||
|
Configure the import alias for utils: › @/lib/utils
|
||||||
|
```
|
||||||
|
|
||||||
|
### That's it
|
||||||
|
|
||||||
|
You can now start adding components to your project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx shadcn-vue@latest add button
|
||||||
|
```
|
||||||
|
|
||||||
|
The command above will add the `Button` component to your project. You can then import it like this:
|
||||||
|
|
||||||
|
```vue {2,7}
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Button>Click me</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
</Steps>
|
||||||
|
|
@ -17,7 +17,6 @@ To use utility classes for theming set `tailwind.cssVariables` to `false` in you
|
||||||
```json {8} title="components.json"
|
```json {8} title="components.json"
|
||||||
{
|
{
|
||||||
"style": "default",
|
"style": "default",
|
||||||
"rsc": true,
|
|
||||||
"tailwind": {
|
"tailwind": {
|
||||||
"config": "tailwind.config.js",
|
"config": "tailwind.config.js",
|
||||||
"css": "app/globals.css",
|
"css": "app/globals.css",
|
||||||
|
|
@ -43,7 +42,6 @@ To use CSS variables for theming set `tailwind.cssVariables` to `true` in your `
|
||||||
```json {8} title="components.json"
|
```json {8} title="components.json"
|
||||||
{
|
{
|
||||||
"style": "default",
|
"style": "default",
|
||||||
"rsc": true,
|
|
||||||
"tailwind": {
|
"tailwind": {
|
||||||
"config": "tailwind.config.js",
|
"config": "tailwind.config.js",
|
||||||
"css": "app/globals.css",
|
"css": "app/globals.css",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
import ChevronDownIcon from '~icons/radix-icons/chevron-down'
|
import ChevronDownIcon from '~icons/radix-icons/chevron-down'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -14,12 +15,16 @@ import {
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from '@/lib/registry/new-york/ui/card'
|
} from '@/lib/registry/new-york/ui/card'
|
||||||
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '@/lib/registry/new-york/ui/command'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/lib/registry/new-york/ui/popover'
|
} from '@/lib/registry/new-york/ui/popover'
|
||||||
|
|
||||||
|
const sofiaRole = ref('Owner')
|
||||||
|
const jacksonRole = ref('Member')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -49,35 +54,35 @@ import {
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger as-child>
|
<PopoverTrigger as-child>
|
||||||
<Button variant="outline" class="ml-auto">
|
<Button variant="outline" class="ml-auto">
|
||||||
Owner
|
{{ sofiaRole }}
|
||||||
<ChevronDownIcon class="ml-2 h-4 w-4 text-muted-foreground" />
|
<ChevronDownIcon class="ml-2 h-4 w-4 text-muted-foreground" />
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="p-0" align="end">
|
<PopoverContent class="p-0" align="end">
|
||||||
<!-- <Command>
|
<Command v-model="sofiaRole">
|
||||||
<CommandInput placeholder="Select new role..." />
|
<CommandInput placeholder="Select new role..." />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandEmpty>No roles found.</CommandEmpty>
|
<CommandEmpty>No roles found.</CommandEmpty>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Viewer" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Viewer</p>
|
<p>Viewer</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view and comment.
|
Can view and comment.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Developer" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Developer</p>
|
<p>Developer</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view, comment and edit.
|
Can view, comment and edit.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Billing" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Billing</p>
|
<p>Billing</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view, comment and manage billing.
|
Can view, comment and manage billing.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Owner" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Owner</p>
|
<p>Owner</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Admin-level access to all resources.
|
Admin-level access to all resources.
|
||||||
|
|
@ -85,7 +90,7 @@ import {
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command> -->
|
</Command>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -107,35 +112,35 @@ import {
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger as-child>
|
<PopoverTrigger as-child>
|
||||||
<Button variant="outline" class="ml-auto">
|
<Button variant="outline" class="ml-auto">
|
||||||
Member
|
{{ jacksonRole }}
|
||||||
<ChevronDownIcon class="ml-2 h-4 w-4 text-muted-foreground" />
|
<ChevronDownIcon class="ml-2 h-4 w-4 text-muted-foreground" />
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="p-0" align="end">
|
<PopoverContent class="p-0" align="end">
|
||||||
<!-- <Command>
|
<Command v-model="jacksonRole">
|
||||||
<CommandInput placeholder="Select new role..." />
|
<CommandInput placeholder="Select new role..." />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandEmpty>No roles found.</CommandEmpty>
|
<CommandEmpty>No roles found.</CommandEmpty>
|
||||||
<CommandGroup class="p-1.5">
|
<CommandGroup>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Viewer" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Viewer</p>
|
<p>Viewer</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view and comment.
|
Can view and comment.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Developer" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Developer</p>
|
<p>Developer</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view, comment and edit.
|
Can view, comment and edit.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Billing" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Billing</p>
|
<p>Billing</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Can view, comment and manage billing.
|
Can view, comment and manage billing.
|
||||||
</p>
|
</p>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
<CommandItem value="Owner" class="teamaspace-y-1 flex flex-col items-start px-4 py-2">
|
||||||
<p>Owner</p>
|
<p>Owner</p>
|
||||||
<p class="text-sm text-muted-foreground">
|
<p class="text-sm text-muted-foreground">
|
||||||
Admin-level access to all resources.
|
Admin-level access to all resources.
|
||||||
|
|
@ -143,7 +148,7 @@ import {
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command> -->
|
</Command>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import CaretSortIcon from '~icons/radix-icons/caret-sort'
|
import CaretSortIcon from '~icons/radix-icons/caret-sort'
|
||||||
|
import CheckIcon from '~icons/radix-icons/check'
|
||||||
|
import PlusCircledIcon from '~icons/radix-icons/plus-circled'
|
||||||
|
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import {
|
import {
|
||||||
|
|
@ -17,7 +19,9 @@ import {
|
||||||
DialogFooter,
|
DialogFooter,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
} from '@/lib/registry/new-york/ui/dialog'
|
} from '@/lib/registry/new-york/ui/dialog'
|
||||||
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '@/lib/registry/new-york/ui/command'
|
||||||
import { Input } from '@/lib/registry/new-york/ui/input'
|
import { Input } from '@/lib/registry/new-york/ui/input'
|
||||||
import { Label } from '@/lib/registry/new-york/ui/label'
|
import { Label } from '@/lib/registry/new-york/ui/label'
|
||||||
import {
|
import {
|
||||||
|
|
@ -88,52 +92,50 @@ const selectedTeam = ref<Team>(groups[0].teams[0])
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="w-[200px] p-0">
|
<PopoverContent class="w-[200px] p-0">
|
||||||
<!-- <Command>
|
<Command :filter-function="(list, term) => list.filter(i => i.label?.toLowerCase()?.includes(term)) ">
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandInput placeholder="Search team..." />
|
<CommandInput placeholder="Search team..." />
|
||||||
<CommandEmpty>No team found.</CommandEmpty>
|
<CommandEmpty>No team found.</CommandEmpty>
|
||||||
{groups.map((group) => (
|
<CommandGroup v-for="group in groups" :key="group.label" :heading="group.label">
|
||||||
<CommandGroup key={group.label} heading={group.label}>
|
|
||||||
{group.teams.map((team) => (
|
|
||||||
<CommandItem
|
<CommandItem
|
||||||
key={team.value}
|
v-for="team in group.teams"
|
||||||
onSelect={() => {
|
:key="team.value"
|
||||||
setSelectedTeam(team)
|
:value="team"
|
||||||
setOpen(false)
|
|
||||||
}}
|
|
||||||
class="text-sm"
|
class="text-sm"
|
||||||
|
@select="() => {
|
||||||
|
selectedTeam = team
|
||||||
|
open = false
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<Avatar class="mr-2 h-5 w-5">
|
<Avatar class="mr-2 h-5 w-5">
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://avatar.vercel.sh/${team.value}.png`}
|
:src="`https://avatar.vercel.sh/${team.value}.png`"
|
||||||
alt={team.label}
|
:alt="team.label"
|
||||||
class="grayscale"
|
class="grayscale"
|
||||||
/>
|
/>
|
||||||
<AvatarFallback>SC</AvatarFallback>
|
<AvatarFallback>SC</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
{team.label}
|
{{ team.label }}
|
||||||
<CheckIcon
|
<CheckIcon
|
||||||
class={cn(
|
:class="cn('ml-auto h-4 w-4',
|
||||||
"ml-auto h-4 w-4",
|
|
||||||
selectedTeam.value === team.value
|
selectedTeam.value === team.value
|
||||||
? "opacity-100"
|
? 'opacity-100'
|
||||||
: "opacity-0"
|
: 'opacity-0',
|
||||||
)}
|
)"
|
||||||
/>
|
/>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
))}
|
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
))}
|
|
||||||
</CommandList>
|
</CommandList>
|
||||||
<CommandSeparator />
|
<CommandSeparator />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger as-child>
|
||||||
<CommandItem
|
<CommandItem
|
||||||
onSelect={() => {
|
:value="{ label: 'Create Team' }"
|
||||||
setOpen(false)
|
@select="() => {
|
||||||
setShowNewTeamDialog(true)
|
open = false
|
||||||
}}
|
showNewTeamDialog = true
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<PlusCircledIcon class="mr-2 h-5 w-5" />
|
<PlusCircledIcon class="mr-2 h-5 w-5" />
|
||||||
Create Team
|
Create Team
|
||||||
|
|
@ -141,7 +143,7 @@ const selectedTeam = ref<Team>(groups[0].teams[0])
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command> -->
|
</Command>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,16 @@ import { Separator } from '@/lib/registry/new-york/ui/separator'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="md:hidden" />
|
<div class="md:hidden">
|
||||||
|
<VPImage
|
||||||
|
alt="Forms"
|
||||||
|
width="1280"
|
||||||
|
height="1214" class="block" :image="{
|
||||||
|
dark: '/examples/forms-dark.png',
|
||||||
|
light: '/examples/forms-light.png',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="hidden space-y-6 p-10 pb-16 md:block">
|
<div class="hidden space-y-6 p-10 pb-16 md:block">
|
||||||
<div class="space-y-0.5">
|
<div class="space-y-0.5">
|
||||||
<h2 class="text-2xl font-bold tracking-tight">
|
<h2 class="text-2xl font-bold tracking-tight">
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Column } from '@tanstack/vue-table'
|
import type { Column } from '@tanstack/vue-table'
|
||||||
import type { Component } from 'vue'
|
import type { Component } from 'vue'
|
||||||
import { computed } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { type Task } from '../data/schema'
|
import { type Task } from '../data/schema'
|
||||||
import PlusCircledIcon from '~icons/radix-icons/plus-circled'
|
import PlusCircledIcon from '~icons/radix-icons/plus-circled'
|
||||||
|
import CheckIcon from '~icons/radix-icons/check'
|
||||||
|
|
||||||
import { Badge } from '@/lib/registry/new-york/ui/badge'
|
import { Badge } from '@/lib/registry/new-york/ui/badge'
|
||||||
import { Button } from '@/lib/registry/new-york/ui/button'
|
import { Button } from '@/lib/registry/new-york/ui/button'
|
||||||
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '@/lib/registry/new-york/ui/command'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
|
|
@ -14,6 +16,7 @@ import {
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/lib/registry/new-york/ui/popover'
|
} from '@/lib/registry/new-york/ui/popover'
|
||||||
import { Separator } from '@/lib/registry/new-york/ui/separator'
|
import { Separator } from '@/lib/registry/new-york/ui/separator'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
interface DataTableFacetedFilter {
|
interface DataTableFacetedFilter {
|
||||||
column?: Column<Task, any>
|
column?: Column<Task, any>
|
||||||
|
|
@ -70,66 +73,63 @@ const selectedValues = computed(() => new Set(props.column?.getFilterValue() as
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="w-[200px] p-0" align="start">
|
<PopoverContent class="w-[200px] p-0" align="start">
|
||||||
<!-- <Command>
|
<Command
|
||||||
<CommandInput placeholder={title} />
|
:filter-function="(list: DataTableFacetedFilter['options'], term) => list.filter(i => i.label.toLowerCase()?.includes(term)) "
|
||||||
|
>
|
||||||
|
<CommandInput :placeholder="title" />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandEmpty>No results found.</CommandEmpty>
|
<CommandEmpty>No results found.</CommandEmpty>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
{options.map((option) => {
|
|
||||||
const isSelected = selectedValues.has(option.value)
|
|
||||||
return (
|
|
||||||
<CommandItem
|
<CommandItem
|
||||||
key={option.value}
|
v-for="option in options"
|
||||||
onSelect={() => {
|
:key="option.value"
|
||||||
|
:value="option"
|
||||||
|
@select="() => {
|
||||||
|
const isSelected = selectedValues.has(option.value)
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
selectedValues.delete(option.value)
|
selectedValues.delete(option.value)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
selectedValues.add(option.value)
|
selectedValues.add(option.value)
|
||||||
}
|
}
|
||||||
const filterValues = Array.from(selectedValues)
|
const filterValues = Array.from(selectedValues)
|
||||||
column?.setFilterValue(
|
column?.setFilterValue(
|
||||||
filterValues.length ? filterValues : undefined
|
filterValues.length ? filterValues : undefined,
|
||||||
)
|
)
|
||||||
}}
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class={cn(
|
:class="cn(
|
||||||
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
|
'mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary',
|
||||||
isSelected
|
selectedValues.has(option.value)
|
||||||
? "bg-primary text-primary-foreground"
|
? 'bg-primary text-primary-foreground'
|
||||||
: "opacity-50 [&_svg]:invisible"
|
: 'opacity-50 [&_svg]:invisible',
|
||||||
)}
|
)"
|
||||||
>
|
>
|
||||||
<CheckIcon class={cn("h-4 w-4")} />
|
<CheckIcon :class="cn('h-4 w-4')" />
|
||||||
</div>
|
</div>
|
||||||
{option.icon && (
|
<option.icon v-if="option.icon" class="mr-2 h-4 w-4 text-muted-foreground" />
|
||||||
<option.icon class="mr-2 h-4 w-4 text-muted-foreground" />
|
<span>{{ option.label }}</span>
|
||||||
)}
|
<span v-if="facets?.get(option.value)" class="ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs">
|
||||||
<span>{option.label}</span>
|
{{ facets.get(option.value) }}
|
||||||
{facets?.get(option.value) && (
|
|
||||||
<span class="ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs">
|
|
||||||
{facets.get(option.value)}
|
|
||||||
</span>
|
</span>
|
||||||
)}
|
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
)
|
|
||||||
})}
|
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
{selectedValues.size > 0 && (
|
|
||||||
<>
|
<template v-if="selectedValues.size > 0">
|
||||||
<CommandSeparator />
|
<CommandSeparator />
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
<CommandItem
|
<CommandItem
|
||||||
onSelect={() => column?.setFilterValue(undefined)}
|
:value="{ label: 'Clear filters' }"
|
||||||
class="justify-center text-center"
|
class="justify-center text-center"
|
||||||
|
@select="column?.setFilterValue(undefined)"
|
||||||
>
|
>
|
||||||
Clear filters
|
Clear filters
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</>
|
</template>
|
||||||
)}
|
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command> -->
|
</Command>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
100
apps/www/src/lib/registry/default/example/Cards/ActivityGoal.vue
Normal file
100
apps/www/src/lib/registry/default/example/Cards/ActivityGoal.vue
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { Button } from '@/lib/registry/default/ui/button'
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardFooter,
|
||||||
|
CardHeader,
|
||||||
|
CardTitle,
|
||||||
|
} from '@/lib/registry/default/ui/card'
|
||||||
|
import { themes } from '@/lib/registry/themes'
|
||||||
|
import { useConfigStore } from '@/stores/config'
|
||||||
|
|
||||||
|
const { theme, radius, setRadius, setTheme } = useConfigStore()
|
||||||
|
|
||||||
|
const goal = ref(350)
|
||||||
|
|
||||||
|
const data = [
|
||||||
|
{ goal: 400 },
|
||||||
|
{ goal: 300 },
|
||||||
|
{ goal: 200 },
|
||||||
|
{ goal: 300 },
|
||||||
|
{ goal: 200 },
|
||||||
|
{ goal: 278 },
|
||||||
|
{ goal: 189 },
|
||||||
|
{ goal: 239 },
|
||||||
|
{ goal: 300 },
|
||||||
|
{ goal: 200 },
|
||||||
|
{ goal: 278 },
|
||||||
|
{ goal: 189 },
|
||||||
|
{ goal: 349 },
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Card>
|
||||||
|
<CardHeader class-name="pb-4">
|
||||||
|
<CardTitle class-name="text-base">
|
||||||
|
Move Goal
|
||||||
|
</CardTitle>
|
||||||
|
<CardDescription>Set your daily activity goal.</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent class-name="pb-2">
|
||||||
|
<div className="flex items-center justify-center space-x-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="icon"
|
||||||
|
class-name="h-8 w-8 shrink-0 rounded-full"
|
||||||
|
:disabled="goal <= 200"
|
||||||
|
@click="goal -= 10"
|
||||||
|
>
|
||||||
|
<Minus class-name="h-4 w-4" />
|
||||||
|
<span className="sr-only">Decrease</span>
|
||||||
|
</Button>
|
||||||
|
<div className="flex-1 text-center">
|
||||||
|
<div className="text-5xl font-bold tracking-tighter">
|
||||||
|
{{ goal }}
|
||||||
|
</div>
|
||||||
|
<div className="text-[0.70rem] uppercase text-muted-foreground">
|
||||||
|
Calories/day
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="icon"
|
||||||
|
class-name="h-8 w-8 shrink-0 rounded-full"
|
||||||
|
:disabled="goal >= 400"
|
||||||
|
@click="goal += 10 "
|
||||||
|
>
|
||||||
|
<Plus class-name="h-4 w-4" />
|
||||||
|
<span className="sr-only">Increase</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div className="my-3 h-[60px]">
|
||||||
|
<!-- <ResponsiveContainer width="100%" height="100%">
|
||||||
|
<BarChart data="{data}">
|
||||||
|
<Bar
|
||||||
|
data-key="goal"
|
||||||
|
style="{"
|
||||||
|
{
|
||||||
|
fill: "var(--theme-primary)",
|
||||||
|
opacity: 0.2,
|
||||||
|
"--theme-primary": `hsl(${
|
||||||
|
theme?.cssVars[mode="==" "dark" ? "dark" : "light"].primary
|
||||||
|
})`,
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer> -->
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<Button class-name="w-full">
|
||||||
|
Set Goal
|
||||||
|
</Button>
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
|
</template>
|
||||||
125
apps/www/src/lib/registry/default/example/Cards/index.vue
Normal file
125
apps/www/src/lib/registry/default/example/Cards/index.vue
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { ChevronDown, Minus, Plus, Send } from 'lucide-vue-next'
|
||||||
|
import { addDays, startOfToday } from 'date-fns'
|
||||||
|
import {
|
||||||
|
months,
|
||||||
|
payments,
|
||||||
|
roles,
|
||||||
|
teamMembers,
|
||||||
|
years,
|
||||||
|
} from './utils/data'
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardFooter,
|
||||||
|
CardHeader,
|
||||||
|
CardTitle,
|
||||||
|
} from '@/lib/registry/default/ui/card'
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
AvatarFallback,
|
||||||
|
AvatarImage,
|
||||||
|
} from '@/lib/registry/default/ui/avatar'
|
||||||
|
import { Button } from '@/lib/registry/default/ui/button'
|
||||||
|
import { Textarea } from '@/lib/registry/default/ui/textarea'
|
||||||
|
import { Calendar } from '@/lib/registry/default/ui/calendar'
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuGroup,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuLabel,
|
||||||
|
DropdownMenuSeparator,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/lib/registry/default/ui/dropdown-menu'
|
||||||
|
import { Label } from '@/lib/registry/default/ui/label'
|
||||||
|
import { Switch } from '@/lib/registry/default/ui/switch'
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from '@/lib/registry/default/ui/select'
|
||||||
|
import { Input } from '@/lib/registry/default/ui/input'
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipProvider,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from '@/lib/registry/default/ui/tooltip'
|
||||||
|
import { Separator } from '@/lib/registry/default/ui/separator'
|
||||||
|
import RadixIconsGithubLogo from '~icons/radix-icons/github-logo'
|
||||||
|
import RiGoogleLine from '~icons/ri/google-line'
|
||||||
|
|
||||||
|
const strictlyNecessarySwitch = ref<boolean>(true)
|
||||||
|
const functionalCookiesSwitch = ref<boolean>(false)
|
||||||
|
const performanceCookiesSwitch = ref<boolean>(false)
|
||||||
|
const selectedArea = ref('Billing')
|
||||||
|
const selectedSecurity = ref('Medium')
|
||||||
|
const selectedMonth = ref<string>(months[0])
|
||||||
|
const selectedYear = ref<string>(years[0])
|
||||||
|
const selectedPayment = ref(payments[0])
|
||||||
|
const goal = ref(350)
|
||||||
|
|
||||||
|
function switchPayment(payment: any) {
|
||||||
|
selectedPayment.value = payment
|
||||||
|
}
|
||||||
|
|
||||||
|
const range = ref({
|
||||||
|
start: startOfToday(),
|
||||||
|
end: addDays(startOfToday(), 8),
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div className="md:grids-col-2 grid md:gap-4 lg:grid-cols-10 xl:grid-cols-11 xl:gap-4">
|
||||||
|
<div className="space-y-4 lg:col-span-4 xl:col-span-6 xl:space-y-4">
|
||||||
|
<CardsStats />
|
||||||
|
<div className="grid gap-1 sm:grid-cols-[280px_1fr] md:hidden">
|
||||||
|
<CardsCalendar />
|
||||||
|
<div className="pt-3 sm:pl-2 sm:pt-0 xl:pl-4">
|
||||||
|
<CardsActivityGoal />
|
||||||
|
</div>
|
||||||
|
<div className="pt-3 sm:col-span-2 xl:pt-4">
|
||||||
|
<CardsMetric />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2">
|
||||||
|
<div className="space-y-4 xl:space-y-4">
|
||||||
|
<CardsTeamMembers />
|
||||||
|
<CardsCookieSettings />
|
||||||
|
<CardsPaymentMethod />
|
||||||
|
</div>
|
||||||
|
<div className="space-y-4 xl:space-y-4">
|
||||||
|
<CardsChat />
|
||||||
|
<CardsCreateAccount />
|
||||||
|
<div className="hidden xl:block">
|
||||||
|
<CardsReportIssue />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-4 lg:col-span-6 xl:col-span-5 xl:space-y-4">
|
||||||
|
<div className="hidden gap-1 sm:grid-cols-[280px_1fr] md:grid">
|
||||||
|
<CardsCalendar />
|
||||||
|
<div className="pt-3 sm:pl-2 sm:pt-0 xl:pl-3">
|
||||||
|
<CardsActivityGoal />
|
||||||
|
</div>
|
||||||
|
<div className="pt-3 sm:col-span-2 xl:pt-3">
|
||||||
|
<CardsMetric />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="hidden md:block">
|
||||||
|
<CardsDataTable />
|
||||||
|
</div>
|
||||||
|
<CardsShare />
|
||||||
|
<div className="xl:hidden">
|
||||||
|
<CardsReportIssue />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
70
apps/www/src/lib/registry/default/example/ComboboxDemo.vue
Normal file
70
apps/www/src/lib/registry/default/example/ComboboxDemo.vue
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Check, ChevronsUpDown } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/lib/registry/default/ui/button'
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
} from '@/lib/registry/default/ui/command'
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@/lib/registry/default/ui/popover'
|
||||||
|
|
||||||
|
const frameworks = [
|
||||||
|
{ value: 'next.js', label: 'Next.js' },
|
||||||
|
{ value: 'sveltekit', label: 'SvelteKit' },
|
||||||
|
{ value: 'nuxt.js', label: 'Nuxt.js' },
|
||||||
|
{ value: 'remix', label: 'Remix' },
|
||||||
|
{ value: 'astro', label: 'Astro' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const open = ref(false)
|
||||||
|
const value = ref<typeof frameworks[number]>()
|
||||||
|
|
||||||
|
const filterFunction = (list: typeof frameworks, search: string) => list.filter(i => i.value.toLowerCase().includes(search.toLowerCase()))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Popover v-model:open="open">
|
||||||
|
<PopoverTrigger as-child>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
:aria-expanded="open"
|
||||||
|
class="w-[200px] justify-between"
|
||||||
|
>
|
||||||
|
{{ value ? value.label : 'Select framework...' }}
|
||||||
|
<ChevronsUpDown class="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent class="w-[200px] p-0">
|
||||||
|
<Command v-model="value" :filter-function="filterFunction">
|
||||||
|
<CommandInput placeholder="Search framework..." />
|
||||||
|
<CommandEmpty>No framework found.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
<CommandItem
|
||||||
|
v-for="framework in frameworks"
|
||||||
|
:key="framework.value"
|
||||||
|
:value="framework"
|
||||||
|
@select="open = false"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
:class="cn(
|
||||||
|
'mr-2 h-4 w-4',
|
||||||
|
value?.value === framework.value ? 'opacity-100' : 'opacity-0',
|
||||||
|
)"
|
||||||
|
/>
|
||||||
|
{{ framework.label }}
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</template>
|
||||||
62
apps/www/src/lib/registry/default/example/CommandDemo.vue
Normal file
62
apps/www/src/lib/registry/default/example/CommandDemo.vue
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
Calculator,
|
||||||
|
Calendar,
|
||||||
|
CreditCard,
|
||||||
|
Settings,
|
||||||
|
Smile,
|
||||||
|
User,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
CommandList,
|
||||||
|
CommandSeparator,
|
||||||
|
CommandShortcut,
|
||||||
|
} from '@/lib/registry/default/ui/command'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Command class="rounded-lg border shadow-md max-w-[450px]">
|
||||||
|
<CommandInput placeholder="Type a command or search..." />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty>No results found.</CommandEmpty>
|
||||||
|
<CommandGroup heading="Suggestions">
|
||||||
|
<CommandItem value="Calendar">
|
||||||
|
<Calendar class="mr-2 h-4 w-4" />
|
||||||
|
<span>Calendar</span>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Search Emoji">
|
||||||
|
<Smile class="mr-2 h-4 w-4" />
|
||||||
|
<span>Search Emoji</span>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Calculator">
|
||||||
|
<Calculator class="mr-2 h-4 w-4" />
|
||||||
|
<span>Calculator</span>
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
<CommandSeparator />
|
||||||
|
<CommandGroup heading="Settings">
|
||||||
|
<CommandItem value="Profile">
|
||||||
|
<User class="mr-2 h-4 w-4" />
|
||||||
|
<span>Profile</span>
|
||||||
|
<CommandShortcut>⌘P</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Billing">
|
||||||
|
<CreditCard class="mr-2 h-4 w-4" />
|
||||||
|
<span>Billing</span>
|
||||||
|
<CommandShortcut>⌘B</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Settings">
|
||||||
|
<Settings class="mr-2 h-4 w-4" />
|
||||||
|
<span>Settings</span>
|
||||||
|
<CommandShortcut>⌘S</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</template>
|
||||||
21
apps/www/src/lib/registry/default/ui/command/Command.vue
Normal file
21
apps/www/src/lib/registry/default/ui/command/Command.vue
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
||||||
|
import { ComboboxRoot } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxRootProps>()
|
||||||
|
const emits = defineEmits<ComboboxRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxRoot
|
||||||
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
|
:open="true"
|
||||||
|
:model-value="''"
|
||||||
|
:class="cn('flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxRoot>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { DialogRootEmits, DialogRootProps } from 'radix-vue'
|
||||||
|
import Command from './Command.vue'
|
||||||
|
import { Dialog, DialogContent } from '@/lib/registry/default/ui/dialog'
|
||||||
|
import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<DialogRootProps>()
|
||||||
|
const emits = defineEmits<DialogRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Dialog v-bind="{ ...props, ...emitsAsProps }">
|
||||||
|
<DialogContent class="overflow-hidden p-0 shadow-lg">
|
||||||
|
<Command class="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
||||||
|
<slot />
|
||||||
|
</Command>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxEmptyProps } from 'radix-vue'
|
||||||
|
import { ComboboxEmpty } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxEmptyProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxEmpty v-bind="props" :class="cn('py-6 text-center text-sm', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</ComboboxEmpty>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxGroupProps } from 'radix-vue'
|
||||||
|
import { ComboboxGroup, ComboboxLabel } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxGroupProps & {
|
||||||
|
heading?: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxGroup
|
||||||
|
v-bind="props"
|
||||||
|
:class="cn('overflow-hidden p-1 text-foreground', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<ComboboxLabel v-if="heading" class="px-2 py-1.5 text-xs font-medium text-muted-foreground">
|
||||||
|
{{ heading }}
|
||||||
|
</ComboboxLabel>
|
||||||
|
<slot />
|
||||||
|
</ComboboxGroup>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Search } from 'lucide-vue-next'
|
||||||
|
import { ComboboxInput, type ComboboxInputProps } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxInputProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
inheritAttrs: false,
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
|
||||||
|
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
<ComboboxInput
|
||||||
|
v-bind="{ ...props, ...$attrs }"
|
||||||
|
auto-focus
|
||||||
|
:class="cn('flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', $attrs.class ?? '')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
19
apps/www/src/lib/registry/default/ui/command/CommandItem.vue
Normal file
19
apps/www/src/lib/registry/default/ui/command/CommandItem.vue
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxItemEmits, ComboboxItemProps } from 'radix-vue'
|
||||||
|
import { ComboboxItem } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxItemProps>()
|
||||||
|
const emits = defineEmits<ComboboxItemEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxItem
|
||||||
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
|
:class="cn('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxItem>
|
||||||
|
</template>
|
||||||
16
apps/www/src/lib/registry/default/ui/command/CommandList.vue
Normal file
16
apps/www/src/lib/registry/default/ui/command/CommandList.vue
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxContentEmits, ComboboxContentProps } from 'radix-vue'
|
||||||
|
import { ComboboxContent } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxContentProps>()
|
||||||
|
const emits = defineEmits<ComboboxContentEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxContent v-bind="{ ...props, ...emitsAsProps }" :class="cn('max-h-[300px] overflow-y-auto overflow-x-hidden', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</ComboboxContent>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxSeparatorProps } from 'radix-vue'
|
||||||
|
import { ComboboxSeparator } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxSeparatorProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxSeparator
|
||||||
|
v-bind="props"
|
||||||
|
:class="cn('-mx-1 h-px bg-border', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxSeparator>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span :class="cn('ml-auto text-xs tracking-widest text-muted-foreground', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
9
apps/www/src/lib/registry/default/ui/command/index.ts
Normal file
9
apps/www/src/lib/registry/default/ui/command/index.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
export { default as Command } from './Command.vue'
|
||||||
|
export { default as CommandDialog } from './CommandDialog.vue'
|
||||||
|
export { default as CommandEmpty } from './CommandEmpty.vue'
|
||||||
|
export { default as CommandGroup } from './CommandGroup.vue'
|
||||||
|
export { default as CommandInput } from './CommandInput.vue'
|
||||||
|
export { default as CommandItem } from './CommandItem.vue'
|
||||||
|
export { default as CommandList } from './CommandList.vue'
|
||||||
|
export { default as CommandSeparator } from './CommandSeparator.vue'
|
||||||
|
export { default as CommandShortcut } from './CommandShortcut.vue'
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PopoverRoot, type PopoverRootProps } from 'radix-vue'
|
import { PopoverRoot } from 'radix-vue'
|
||||||
|
import type { PopoverRootEmits, PopoverRootProps } from 'radix-vue'
|
||||||
|
import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps<PopoverRootProps>()
|
const props = defineProps<PopoverRootProps>()
|
||||||
|
const emits = defineEmits<PopoverRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PopoverRoot v-bind="props">
|
<PopoverRoot v-bind="{ ...props, ...emitsAsProps }">
|
||||||
<slot />
|
<slot />
|
||||||
</PopoverRoot>
|
</PopoverRoot>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
71
apps/www/src/lib/registry/new-york/example/ComboboxDemo.vue
Normal file
71
apps/www/src/lib/registry/new-york/example/ComboboxDemo.vue
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import Check from '~icons/radix-icons/check'
|
||||||
|
import CaretSort from '~icons/radix-icons/caret-sort'
|
||||||
|
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/lib/registry/default/ui/button'
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
} from '@/lib/registry/default/ui/command'
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@/lib/registry/default/ui/popover'
|
||||||
|
|
||||||
|
const frameworks = [
|
||||||
|
{ value: 'next.js', label: 'Next.js' },
|
||||||
|
{ value: 'sveltekit', label: 'SvelteKit' },
|
||||||
|
{ value: 'nuxt.js', label: 'Nuxt.js' },
|
||||||
|
{ value: 'remix', label: 'Remix' },
|
||||||
|
{ value: 'astro', label: 'Astro' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const open = ref(false)
|
||||||
|
const value = ref<typeof frameworks[number]>()
|
||||||
|
|
||||||
|
const filterFunction = (list: typeof frameworks, search: string) => list.filter(i => i.value.toLowerCase().includes(search.toLowerCase()))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Popover v-model:open="open">
|
||||||
|
<PopoverTrigger as-child>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
:aria-expanded="open"
|
||||||
|
class="w-[200px] justify-between"
|
||||||
|
>
|
||||||
|
{{ value ? value.label : 'Select framework...' }}
|
||||||
|
<CaretSort class="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent class="w-[200px] p-0">
|
||||||
|
<Command v-model="value" :filter-function="filterFunction">
|
||||||
|
<CommandInput class="h-9" placeholder="Search framework..." />
|
||||||
|
<CommandEmpty>No framework found.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
<CommandItem
|
||||||
|
v-for="framework in frameworks"
|
||||||
|
:key="framework.value"
|
||||||
|
:value="framework"
|
||||||
|
@select="open = false"
|
||||||
|
>
|
||||||
|
{{ framework.label }}
|
||||||
|
<Check
|
||||||
|
:class="cn(
|
||||||
|
'ml-auto h-4 w-4',
|
||||||
|
value?.value === framework.value ? 'opacity-100' : 'opacity-0',
|
||||||
|
)"
|
||||||
|
/>
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</template>
|
||||||
62
apps/www/src/lib/registry/new-york/example/CommandDemo.vue
Normal file
62
apps/www/src/lib/registry/new-york/example/CommandDemo.vue
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
Calculator,
|
||||||
|
Calendar,
|
||||||
|
CreditCard,
|
||||||
|
Settings,
|
||||||
|
Smile,
|
||||||
|
User,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
CommandList,
|
||||||
|
CommandSeparator,
|
||||||
|
CommandShortcut,
|
||||||
|
} from '@/lib/registry/new-york/ui/command'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Command class="rounded-lg border shadow-md max-w-[450px]">
|
||||||
|
<CommandInput placeholder="Type a command or search..." />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty>No results found.</CommandEmpty>
|
||||||
|
<CommandGroup heading="Suggestions">
|
||||||
|
<CommandItem value="Calendar">
|
||||||
|
<Calendar class="mr-2 h-4 w-4" />
|
||||||
|
<span>Calendar</span>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Search Emoji">
|
||||||
|
<Smile class="mr-2 h-4 w-4" />
|
||||||
|
<span>Search Emoji</span>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Calculator">
|
||||||
|
<Calculator class="mr-2 h-4 w-4" />
|
||||||
|
<span>Calculator</span>
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
<CommandSeparator />
|
||||||
|
<CommandGroup heading="Settings">
|
||||||
|
<CommandItem value="Profile">
|
||||||
|
<User class="mr-2 h-4 w-4" />
|
||||||
|
<span>Profile</span>
|
||||||
|
<CommandShortcut>⌘P</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Billing">
|
||||||
|
<CreditCard class="mr-2 h-4 w-4" />
|
||||||
|
<span>Billing</span>
|
||||||
|
<CommandShortcut>⌘B</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
<CommandItem value="Settings">
|
||||||
|
<Settings class="mr-2 h-4 w-4" />
|
||||||
|
<span>Settings</span>
|
||||||
|
<CommandShortcut>⌘S</CommandShortcut>
|
||||||
|
</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</template>
|
||||||
20
apps/www/src/lib/registry/new-york/ui/command/Command.vue
Normal file
20
apps/www/src/lib/registry/new-york/ui/command/Command.vue
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
||||||
|
import { ComboboxRoot } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxRootProps>()
|
||||||
|
const emits = defineEmits<ComboboxRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxRoot
|
||||||
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
|
:open="true"
|
||||||
|
:class="cn('flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxRoot>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { DialogRootEmits, DialogRootProps } from 'radix-vue'
|
||||||
|
import Command from './Command.vue'
|
||||||
|
import { Dialog, DialogContent } from '@/lib/registry/new-york/ui/dialog'
|
||||||
|
import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<DialogRootProps>()
|
||||||
|
const emits = defineEmits<DialogRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Dialog v-bind="{ ...props, ...emitsAsProps }">
|
||||||
|
<DialogContent class="overflow-hidden p-0 shadow-lg">
|
||||||
|
<Command class="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
||||||
|
<slot />
|
||||||
|
</Command>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxEmptyProps } from 'radix-vue'
|
||||||
|
import { ComboboxEmpty } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxEmptyProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxEmpty v-bind="props" :class="cn('py-6 text-center text-sm', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</ComboboxEmpty>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxGroupProps } from 'radix-vue'
|
||||||
|
import { ComboboxGroup, ComboboxLabel } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxGroupProps & {
|
||||||
|
heading?: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxGroup
|
||||||
|
v-bind="props"
|
||||||
|
:class="cn('overflow-hidden p-1 text-foreground', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<ComboboxLabel v-if="heading" class="px-2 py-1.5 text-xs font-medium text-muted-foreground">
|
||||||
|
{{ heading }}
|
||||||
|
</ComboboxLabel>
|
||||||
|
<slot />
|
||||||
|
</ComboboxGroup>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Search } from 'lucide-vue-next'
|
||||||
|
import { ComboboxInput, type ComboboxInputProps } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxInputProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
inheritAttrs: false,
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
|
||||||
|
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
<ComboboxInput
|
||||||
|
v-bind="{ ...props, ...$attrs }"
|
||||||
|
auto-focus
|
||||||
|
:class="cn('flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', $attrs.class ?? '')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxItemEmits, ComboboxItemProps } from 'radix-vue'
|
||||||
|
import { ComboboxItem } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxItemProps>()
|
||||||
|
const emits = defineEmits<ComboboxItemEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxItem
|
||||||
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
|
:class="cn('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxItem>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxContentEmits, ComboboxContentProps } from 'radix-vue'
|
||||||
|
import { ComboboxContent } from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxContentProps>()
|
||||||
|
const emits = defineEmits<ComboboxContentEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxContent v-bind="{ ...props, ...emitsAsProps }" :class="cn('max-h-[300px] overflow-y-auto overflow-x-hidden', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</ComboboxContent>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ComboboxSeparatorProps } from 'radix-vue'
|
||||||
|
import { ComboboxSeparator } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<ComboboxSeparatorProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ComboboxSeparator
|
||||||
|
v-bind="props"
|
||||||
|
:class="cn('-mx-1 h-px bg-border', $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</ComboboxSeparator>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span :class="cn('ml-auto text-xs tracking-widest text-muted-foreground', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
9
apps/www/src/lib/registry/new-york/ui/command/index.ts
Normal file
9
apps/www/src/lib/registry/new-york/ui/command/index.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
export { default as Command } from './Command.vue'
|
||||||
|
export { default as CommandDialog } from './CommandDialog.vue'
|
||||||
|
export { default as CommandEmpty } from './CommandEmpty.vue'
|
||||||
|
export { default as CommandGroup } from './CommandGroup.vue'
|
||||||
|
export { default as CommandInput } from './CommandInput.vue'
|
||||||
|
export { default as CommandItem } from './CommandItem.vue'
|
||||||
|
export { default as CommandList } from './CommandList.vue'
|
||||||
|
export { default as CommandSeparator } from './CommandSeparator.vue'
|
||||||
|
export { default as CommandShortcut } from './CommandShortcut.vue'
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PopoverRoot, type PopoverRootProps } from 'radix-vue'
|
import { PopoverRoot } from 'radix-vue'
|
||||||
|
import type { PopoverRootEmits, PopoverRootProps } from 'radix-vue'
|
||||||
|
import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps<PopoverRootProps>()
|
const props = defineProps<PopoverRootProps>()
|
||||||
|
const emits = defineEmits<PopoverRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PopoverRoot v-bind="props">
|
<PopoverRoot v-bind="{ ...props, ...emitsAsProps }">
|
||||||
<slot />
|
<slot />
|
||||||
</PopoverRoot>
|
</PopoverRoot>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,29 @@
|
||||||
],
|
],
|
||||||
"type": "components:ui"
|
"type": "components:ui"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "command",
|
||||||
|
"dependencies": [
|
||||||
|
"radix-vue"
|
||||||
|
],
|
||||||
|
"registryDependencies": [
|
||||||
|
"utils",
|
||||||
|
"dialog"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"ui/command/Command.vue",
|
||||||
|
"ui/command/CommandDialog.vue",
|
||||||
|
"ui/command/CommandEmpty.vue",
|
||||||
|
"ui/command/CommandGroup.vue",
|
||||||
|
"ui/command/CommandInput.vue",
|
||||||
|
"ui/command/CommandItem.vue",
|
||||||
|
"ui/command/CommandList.vue",
|
||||||
|
"ui/command/CommandSeparator.vue",
|
||||||
|
"ui/command/CommandShortcut.vue",
|
||||||
|
"ui/command/index.ts"
|
||||||
|
],
|
||||||
|
"type": "components:ui"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "context-menu",
|
"name": "context-menu",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,52 @@
|
||||||
{
|
{
|
||||||
"name": "command",
|
"name": "command",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"cmdk"
|
"radix-vue"
|
||||||
],
|
],
|
||||||
"registryDependencies": [
|
"registryDependencies": [
|
||||||
|
"utils",
|
||||||
"dialog"
|
"dialog"
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"name": "command.tsx",
|
"name": "Command.vue",
|
||||||
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { DialogProps } from \"@radix-ui/react-dialog\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Dialog, DialogContent } from \"@/registry/default/ui/dialog\"\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ class, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n class={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n class\n )}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent class=\"overflow-hidden p-0 shadow-lg\">\n <Command class=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ class, ...props }, ref) => (\n <div class=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <Search class=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n class={cn(\n \"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n class\n )}\n {...props}\n />\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ class, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n class={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", class)}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n class=\"py-6 text-center text-sm\"\n {...props}\n />\n))\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ class, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n class={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n class\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ class, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n class={cn(\"-mx-1 h-px bg-border\", class)}\n {...props}\n />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ class, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n class={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n class\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({\n class,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n class={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n class\n )}\n {...props}\n />\n )\n}\nCommandShortcut.displayName = \"CommandShortcut\"\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n"
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'\nimport { ComboboxRoot } from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<ComboboxRootProps>()\nconst emits = defineEmits<ComboboxRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <ComboboxRoot\n v-bind=\"{ ...props, ...emitsAsProps }\"\n :open=\"true\"\n :model-value=\"''\"\n :class=\"cn('flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground', $attrs.class ?? '')\"\n >\n <slot />\n </ComboboxRoot>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandDialog.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { DialogRootEmits, DialogRootProps } from 'radix-vue'\nimport Command from './Command.vue'\nimport { Dialog, DialogContent } from '@/lib/registry/default/ui/dialog'\nimport { useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<DialogRootProps>()\nconst emits = defineEmits<DialogRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <Dialog v-bind=\"{ ...props, ...emitsAsProps }\">\n <DialogContent class=\"overflow-hidden p-0 shadow-lg\">\n <Command class=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n <slot />\n </Command>\n </DialogContent>\n </Dialog>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandEmpty.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxEmptyProps } from 'radix-vue'\nimport { ComboboxEmpty } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<ComboboxEmptyProps>()\n</script>\n\n<template>\n <ComboboxEmpty v-bind=\"props\" :class=\"cn('py-6 text-center text-sm', $attrs.class ?? '')\">\n <slot />\n </ComboboxEmpty>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandGroup.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxGroupProps } from 'radix-vue'\nimport { ComboboxGroup, ComboboxLabel } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<ComboboxGroupProps & {\n heading?: string\n}>()\n</script>\n\n<template>\n <ComboboxGroup\n v-bind=\"props\"\n :class=\"cn('overflow-hidden p-1 text-foreground', $attrs.class ?? '')\"\n >\n <ComboboxLabel v-if=\"heading\" class=\"px-2 py-1.5 text-xs font-medium text-muted-foreground\">\n {{ heading }}\n </ComboboxLabel>\n <slot />\n </ComboboxGroup>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandInput.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport { Search } from 'lucide-vue-next'\nimport { ComboboxInput, type ComboboxInputProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<ComboboxInputProps>()\n</script>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n}\n</script>\n\n<template>\n <div class=\"flex items-center border-b px-3\" cmdk-input-wrapper>\n <Search class=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <ComboboxInput\n v-bind=\"{ ...props, ...$attrs }\"\n auto-focus\n :class=\"cn('flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', $attrs.class ?? '')\"\n />\n </div>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandItem.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxItemEmits, ComboboxItemProps } from 'radix-vue'\nimport { ComboboxItem } from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<ComboboxItemProps>()\nconst emits = defineEmits<ComboboxItemEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <ComboboxItem\n v-bind=\"{ ...props, ...emitsAsProps }\"\n :class=\"cn('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', $attrs.class ?? '')\"\n >\n <slot />\n </ComboboxItem>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandList.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxContentEmits, ComboboxContentProps } from 'radix-vue'\nimport { ComboboxContent } from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<ComboboxContentProps>()\nconst emits = defineEmits<ComboboxContentEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <ComboboxContent v-bind=\"{ ...props, ...emitsAsProps }\" :class=\"cn('max-h-[300px] overflow-y-auto overflow-x-hidden', $attrs.class ?? '')\">\n <slot />\n </ComboboxContent>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandSeparator.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport type { ComboboxSeparatorProps } from 'radix-vue'\nimport { ComboboxSeparator } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<ComboboxSeparatorProps>()\n</script>\n\n<template>\n <ComboboxSeparator\n v-bind=\"props\"\n :class=\"cn('-mx-1 h-px bg-border', $attrs.class ?? '')\"\n >\n <slot />\n </ComboboxSeparator>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommandShortcut.vue",
|
||||||
|
"content": "<script setup lang=\"ts\">\nimport { cn } from '@/lib/utils'\n</script>\n\n<template>\n <span :class=\"cn('ml-auto text-xs tracking-widest text-muted-foreground', $attrs.class ?? '')\">\n <slot />\n </span>\n</template>\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index.ts",
|
||||||
|
"content": "export { default as Command } from './Command.vue'\nexport { default as CommandDialog } from './CommandDialog.vue'\nexport { default as CommandEmpty } from './CommandEmpty.vue'\nexport { default as CommandGroup } from './CommandGroup.vue'\nexport { default as CommandInput } from './CommandInput.vue'\nexport { default as CommandItem } from './CommandItem.vue'\nexport { default as CommandList } from './CommandList.vue'\nexport { default as CommandSeparator } from './CommandSeparator.vue'\nexport { default as CommandShortcut } from './CommandShortcut.vue'\n"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "components:ui"
|
"type": "components:ui"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"name": "Popover.vue",
|
"name": "Popover.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport { PopoverRoot, type PopoverRootProps } from 'radix-vue'\n\nconst props = defineProps<PopoverRootProps>()\n</script>\n\n<template>\n <PopoverRoot v-bind=\"props\">\n <slot />\n </PopoverRoot>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport { PopoverRoot } from 'radix-vue'\nimport type { PopoverRootEmits, PopoverRootProps } from 'radix-vue'\nimport { useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<PopoverRootProps>()\nconst emits = defineEmits<PopoverRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <PopoverRoot v-bind=\"{ ...props, ...emitsAsProps }\">\n <slot />\n </PopoverRoot>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PopoverContent.vue",
|
"name": "PopoverContent.vue",
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"name": "RadioGroup.vue",
|
"name": "RadioGroup.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport { RadioGroupRoot, type RadioGroupRootProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<RadioGroupRootProps & { class?: string }>()\n</script>\n\n<template>\n <RadioGroupRoot :class=\"cn('grid gap-2', props.class)\" v-bind=\"props\">\n <slot />\n </RadioGroupRoot>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport { RadioGroupRoot, type RadioGroupRootEmits, type RadioGroupRootProps } from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<RadioGroupRootProps & { class?: string }>()\n\nconst emits = defineEmits<RadioGroupRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <RadioGroupRoot :class=\"cn('grid gap-2', props.class)\" v-bind=\"{ ...props, ...emitsAsProps }\">\n <slot />\n </RadioGroupRoot>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "RadioGroupItem.vue",
|
"name": "RadioGroupItem.vue",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -9,7 +9,7 @@
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"name": "Popover.vue",
|
"name": "Popover.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport { PopoverRoot, type PopoverRootProps } from 'radix-vue'\n\nconst props = defineProps<PopoverRootProps>()\n</script>\n\n<template>\n <PopoverRoot v-bind=\"props\">\n <slot />\n </PopoverRoot>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport { PopoverRoot } from 'radix-vue'\nimport type { PopoverRootEmits, PopoverRootProps } from 'radix-vue'\nimport { useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<PopoverRootProps>()\nconst emits = defineEmits<PopoverRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <PopoverRoot v-bind=\"{ ...props, ...emitsAsProps }\">\n <slot />\n </PopoverRoot>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PopoverContent.vue",
|
"name": "PopoverContent.vue",
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"name": "RadioGroup.vue",
|
"name": "RadioGroup.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport { RadioGroupRoot, type RadioGroupRootProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<RadioGroupRootProps & { class?: string }>()\n</script>\n\n<template>\n <RadioGroupRoot :class=\"cn('grid gap-2', props.class)\" v-bind=\"props\">\n <slot />\n </RadioGroupRoot>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport { RadioGroupRoot, type RadioGroupRootEmits, type RadioGroupRootProps } from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = defineProps<RadioGroupRootProps & { class?: string }>()\n\nconst emits = defineEmits<RadioGroupRootEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <RadioGroupRoot :class=\"cn('grid gap-2', props.class)\" v-bind=\"{ ...props, ...emitsAsProps }\">\n <slot />\n </RadioGroupRoot>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "RadioGroupItem.vue",
|
"name": "RadioGroupItem.vue",
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SelectContent.vue",
|
"name": "SelectContent.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport {\n SelectContent,\n type SelectContentEmits,\n type SelectContentProps,\n SelectPortal,\n SelectViewport,\n} from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = withDefaults(\n defineProps<SelectContentProps & { class?: string }>(), {\n position: 'popper',\n sideOffset: 4,\n },\n)\nconst emits = defineEmits<SelectContentEmits>()\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <SelectPortal>\n <SelectContent\n v-bind=\"{ ...props, ...emitsAsProps, ...$attrs }\"\n :class=\"\n cn(\n 'relative z-50 min-w-[10rem] overflow-hidden rounded-md bg-background border border-border text-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n position === 'popper'\n && 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n props.class,\n )\n \"\n >\n <SelectViewport\n :class=\"\n cn('p-1',\n position === 'popper'\n && 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]')\"\n >\n <slot />\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport {\n SelectContent,\n type SelectContentEmits,\n type SelectContentProps,\n SelectPortal,\n SelectViewport,\n} from 'radix-vue'\nimport { cn, useEmitAsProps } from '@/lib/utils'\n\nconst props = withDefaults(\n defineProps<SelectContentProps & { class?: string }>(), {\n position: 'popper',\n sideOffset: 4,\n },\n)\nconst emits = defineEmits<SelectContentEmits>()\nconst emitsAsProps = useEmitAsProps(emits)\n</script>\n\n<template>\n <SelectPortal>\n <SelectContent\n v-bind=\"{ ...props, ...emitsAsProps, ...$attrs }\"\n :class=\"\n cn(\n 'relative z-50 min-w-[10rem] overflow-hidden rounded-md bg-background border border-border text-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n position === 'popper'\n && 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n props.class,\n )\n \"\n >\n <SelectViewport\n :class=\"\n cn('p-0',\n position === 'popper'\n && 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]')\"\n >\n <slot />\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SelectGroup.vue",
|
"name": "SelectGroup.vue",
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SelectTrigger.vue",
|
"name": "SelectTrigger.vue",
|
||||||
"content": "<script setup lang=\"ts\">\nimport { SelectIcon, SelectTrigger, type SelectTriggerProps } from 'radix-vue'\nimport RadixIconsChevronDown from '~icons/radix-icons/chevron-down'\nimport { cn } from '@/lib/utils'\n\nconst props = withDefaults(\n defineProps<SelectTriggerProps & { class?: string; invalid?: boolean }>(),\n {\n class: '',\n invalid: false,\n },\n)\n</script>\n\n<template>\n <SelectTrigger\n v-bind=\"props\"\n :class=\"[\n cn(\n 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',\n props.class,\n ),\n props.invalid\n ? '!ring-destructive ring-2 placeholder:!text-destructive'\n : '',\n ]\"\n >\n <slot />\n <SelectIcon as-child>\n <RadixIconsChevronDown class=\"w-4 h-4 opacity-50\" />\n </SelectIcon>\n </SelectTrigger>\n</template>\n"
|
"content": "<script setup lang=\"ts\">\nimport { SelectIcon, SelectTrigger, type SelectTriggerProps } from 'radix-vue'\nimport RadixIconsChevronDown from '~icons/radix-icons/chevron-down'\nimport { cn } from '@/lib/utils'\n\nconst props = withDefaults(\n defineProps<SelectTriggerProps & { class?: string; invalid?: boolean }>(),\n {\n class: '',\n invalid: false,\n },\n)\n</script>\n\n<template>\n <SelectTrigger\n v-bind=\"props\"\n :class=\"[\n cn(\n 'flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',\n props.class,\n ),\n props.invalid\n ? '!ring-destructive ring-2 placeholder:!text-destructive'\n : '',\n ]\"\n >\n <slot />\n <SelectIcon as-child>\n <RadixIconsChevronDown class=\"w-4 h-4 opacity-50\" />\n </SelectIcon>\n </SelectTrigger>\n</template>\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SelectValue.vue",
|
"name": "SelectValue.vue",
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,6 @@
|
||||||
},
|
},
|
||||||
"required": ["config", "css", "baseColor", "cssVariables"]
|
"required": ["config", "css", "baseColor", "cssVariables"]
|
||||||
},
|
},
|
||||||
"rsc": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"tsx": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -43,5 +37,5 @@
|
||||||
"required": ["utils", "components"]
|
"required": ["utils", "components"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["style", "tailwind", "rsc", "aliases"]
|
"required": ["style", "tailwind", "aliases"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
package.json
22
package.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "shadcn-vue",
|
"name": "shadcn-vue",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.6.3",
|
"packageManager": "pnpm@8.7.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "radix-vue/shadcn-vue",
|
"repository": "radix-vue/shadcn-vue",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|
@ -19,24 +19,32 @@
|
||||||
"build:registry": "pnpm --filter=www build:registry",
|
"build:registry": "pnpm --filter=www build:registry",
|
||||||
"pub:beta": "cd packages/cli && pnpm pub:beta",
|
"pub:beta": "cd packages/cli && pnpm pub:beta",
|
||||||
"pub:release": "cd packages/cli && pnpm pub:release",
|
"pub:release": "cd packages/cli && pnpm pub:release",
|
||||||
"test": "pnpm --filter shadcn-vue test"
|
"test": "pnpm --filter shadcn-vue test",
|
||||||
|
"taze": "taze major -frI --ignore-paths ./packages/cli/test/** --exclude typescript,/@iconify/",
|
||||||
|
"taze:minor": "taze minor -fwri --ignore-paths ./packages/cli/test/** --exclude /@iconify/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^0.39.7",
|
"@antfu/eslint-config": "^0.41.3",
|
||||||
"@commitlint/cli": "^17.7.1",
|
"@commitlint/cli": "^17.7.1",
|
||||||
"@commitlint/config-conventional": "^17.7.0",
|
"@commitlint/config-conventional": "^17.7.0",
|
||||||
"eslint": "^8.43.0",
|
"eslint": "^8.49.0",
|
||||||
"lint-staged": "^14.0.0",
|
"lint-staged": "^14.0.1",
|
||||||
"pnpm": "^8.6.12",
|
"pnpm": "^8.7.5",
|
||||||
"simple-git-hooks": "^2.9.0",
|
"simple-git-hooks": "^2.9.0",
|
||||||
|
"taze": "^0.11.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vitest": "^0.34.3"
|
"vitest": "^0.34.4"
|
||||||
},
|
},
|
||||||
"commitlint": {
|
"commitlint": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"@commitlint/config-conventional"
|
"@commitlint/config-conventional"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"pnpm": {
|
||||||
|
"patchedDependencies": {
|
||||||
|
"detype@0.6.3": "patches/detype@0.6.3.patch"
|
||||||
|
}
|
||||||
|
},
|
||||||
"simple-git-hooks": {
|
"simple-git-hooks": {
|
||||||
"pre-commit": "pnpm lint-staged",
|
"pre-commit": "pnpm lint-staged",
|
||||||
"commit-msg": "pnpm commitlint --edit ${1}"
|
"commit-msg": "pnpm commitlint --edit ${1}"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "shadcn-vue",
|
"name": "shadcn-vue",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.1.2",
|
"version": "0.1.7",
|
||||||
"description": "Add components to your apps.",
|
"description": "Add components to your apps.",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
@ -45,17 +45,18 @@
|
||||||
"test:ui": "vitest --ui"
|
"test:ui": "vitest --ui"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/ni": "^0.21.6",
|
"@antfu/ni": "^0.21.8",
|
||||||
"@babel/core": "^7.22.11",
|
"@babel/core": "^7.22.17",
|
||||||
"@babel/parser": "^7.22.11",
|
"@babel/parser": "^7.22.16",
|
||||||
"@babel/plugin-transform-typescript": "^7.22.11",
|
"@babel/plugin-transform-typescript": "^7.22.15",
|
||||||
"chalk": "5.3.0",
|
"chalk": "5.3.0",
|
||||||
"commander": "^11.0.0",
|
"commander": "^11.0.0",
|
||||||
"cosmiconfig": "^8.2.0",
|
"cosmiconfig": "^8.3.6",
|
||||||
|
"detype": "^0.6.3",
|
||||||
"diff": "^5.1.0",
|
"diff": "^5.1.0",
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.1.1",
|
||||||
"https-proxy-agent": "^7.0.1",
|
"https-proxy-agent": "^7.0.2",
|
||||||
"lodash.template": "^4.5.0",
|
"lodash.template": "^4.5.0",
|
||||||
"magic-string": "^0.30.3",
|
"magic-string": "^0.30.3",
|
||||||
"node-fetch": "^3.3.2",
|
"node-fetch": "^3.3.2",
|
||||||
|
|
@ -66,7 +67,7 @@
|
||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
"ts-morph": "^19.0.0",
|
"ts-morph": "^19.0.0",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"vite-tsconfig-paths": "^4.2.0",
|
"vite-tsconfig-paths": "^4.2.1",
|
||||||
"zod": "^3.22.2"
|
"zod": "^3.22.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -75,9 +76,9 @@
|
||||||
"@types/fs-extra": "^11.0.1",
|
"@types/fs-extra": "^11.0.1",
|
||||||
"@types/lodash.template": "^4.5.1",
|
"@types/lodash.template": "^4.5.1",
|
||||||
"@types/prompts": "^2.4.4",
|
"@types/prompts": "^2.4.4",
|
||||||
"@vitest/ui": "^0.34.3",
|
"@vitest/ui": "^0.34.4",
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
"type-fest": "^4.3.0",
|
"type-fest": "^4.3.1",
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { execa } from 'execa'
|
||||||
import ora from 'ora'
|
import ora from 'ora'
|
||||||
import prompts from 'prompts'
|
import prompts from 'prompts'
|
||||||
import * as z from 'zod'
|
import * as z from 'zod'
|
||||||
import { transformImport } from '../utils/transformers/transform-import'
|
import { transform } from '@/src/utils/transformers'
|
||||||
import { getConfig } from '@/src/utils/get-config'
|
import { getConfig } from '@/src/utils/get-config'
|
||||||
import { getPackageManager } from '@/src/utils/get-package-manager'
|
import { getPackageManager } from '@/src/utils/get-package-manager'
|
||||||
import { handleError } from '@/src/utils/handle-error'
|
import { handleError } from '@/src/utils/handle-error'
|
||||||
|
|
@ -129,15 +129,11 @@ export const add = new Command()
|
||||||
if (existingComponent.length && !options.overwrite) {
|
if (existingComponent.length && !options.overwrite) {
|
||||||
if (selectedComponents.includes(item.name)) {
|
if (selectedComponents.includes(item.name)) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`\nComponent ${
|
`Component ${item.name} already exists. Use ${chalk.green(
|
||||||
item.name
|
|
||||||
} already exists. Use ${chalk.green(
|
|
||||||
'--overwrite',
|
'--overwrite',
|
||||||
)} to overwrite.`,
|
)} to overwrite.`,
|
||||||
)
|
)
|
||||||
spinner.stop()
|
process.exit(1)
|
||||||
process.exitCode = 1
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
@ -145,18 +141,26 @@ export const add = new Command()
|
||||||
|
|
||||||
for (const file of item.files) {
|
for (const file of item.files) {
|
||||||
const componentDir = path.resolve(targetDir, item.name)
|
const componentDir = path.resolve(targetDir, item.name)
|
||||||
const filePath = path.resolve(
|
let filePath = path.resolve(
|
||||||
targetDir,
|
targetDir,
|
||||||
item.name,
|
item.name,
|
||||||
file.name,
|
file.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run transformers.
|
if (!config.typescript)
|
||||||
const content = transformImport(file.content, config)
|
filePath = filePath.replace(/\.ts$/, '.js')
|
||||||
|
|
||||||
if (!existsSync(componentDir))
|
if (!existsSync(componentDir))
|
||||||
await fs.mkdir(componentDir, { recursive: true })
|
await fs.mkdir(componentDir, { recursive: true })
|
||||||
|
|
||||||
|
// Run transformers.
|
||||||
|
const content = await transform({
|
||||||
|
filename: file.name,
|
||||||
|
raw: file.content,
|
||||||
|
config,
|
||||||
|
baseColor,
|
||||||
|
})
|
||||||
|
|
||||||
await fs.writeFile(filePath, content)
|
await fs.writeFile(filePath, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@ import {
|
||||||
import { logger } from '../utils/logger'
|
import { logger } from '../utils/logger'
|
||||||
import { handleError } from '../utils/handle-error'
|
import { handleError } from '../utils/handle-error'
|
||||||
import { getPackageManager } from '../utils/get-package-manager'
|
import { getPackageManager } from '../utils/get-package-manager'
|
||||||
|
import { transformByDetype } from '../utils/transformers/transform-sfc'
|
||||||
import {
|
import {
|
||||||
type Config,
|
type Config,
|
||||||
DEFAULT_COMPONENTS,
|
DEFAULT_COMPONENTS,
|
||||||
DEFAULT_TAILWIND_CONFIG,
|
DEFAULT_TAILWIND_CONFIG,
|
||||||
DEFAULT_TAILWIND_CSS,
|
|
||||||
DEFAULT_TAILWIND_CSS_NUXT,
|
|
||||||
DEFAULT_UTILS,
|
DEFAULT_UTILS,
|
||||||
|
TAILWIND_CSS_PATH,
|
||||||
getConfig,
|
getConfig,
|
||||||
rawConfigSchema,
|
rawConfigSchema,
|
||||||
resolveConfigPaths,
|
resolveConfigPaths,
|
||||||
|
|
@ -36,11 +36,6 @@ const PROJECT_DEPENDENCIES = {
|
||||||
'clsx',
|
'clsx',
|
||||||
'tailwind-merge',
|
'tailwind-merge',
|
||||||
],
|
],
|
||||||
vue: [
|
|
||||||
'tailwindcss',
|
|
||||||
'postcss',
|
|
||||||
'autoprefixer',
|
|
||||||
],
|
|
||||||
nuxt: [
|
nuxt: [
|
||||||
'@nuxtjs/tailwindcss',
|
'@nuxtjs/tailwindcss',
|
||||||
],
|
],
|
||||||
|
|
@ -112,8 +107,9 @@ export async function promptForConfig(
|
||||||
name: 'framework',
|
name: 'framework',
|
||||||
message: `Which ${highlight('framework')} are you using?`,
|
message: `Which ${highlight('framework')} are you using?`,
|
||||||
choices: [
|
choices: [
|
||||||
{ title: 'Vite + Vue', value: 'vue' },
|
{ title: 'Vite', value: 'vite' },
|
||||||
{ title: 'Nuxt', value: 'nuxt' },
|
{ title: 'Nuxt', value: 'nuxt' },
|
||||||
|
{ title: 'Laravel', value: 'laravel' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -140,7 +136,7 @@ export async function promptForConfig(
|
||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'tailwindCss',
|
name: 'tailwindCss',
|
||||||
message: `Where is your ${highlight('Tailwind CSS')} file?`,
|
message: `Where is your ${highlight('Tailwind CSS')} file?`,
|
||||||
initial: (prev, values) => defaultConfig?.tailwind.css ?? (values.framework === 'nuxt' ? DEFAULT_TAILWIND_CSS_NUXT : DEFAULT_TAILWIND_CSS),
|
initial: (prev, values) => defaultConfig?.tailwind.css ?? TAILWIND_CSS_PATH[values.framework as 'vite' | 'nuxt' | 'laravel'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'toggle',
|
type: 'toggle',
|
||||||
|
|
@ -240,8 +236,8 @@ export async function runInit(cwd: string, config: Config) {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
config.resolvedPaths.tailwindConfig,
|
config.resolvedPaths.tailwindConfig,
|
||||||
config.tailwind.cssVariables
|
config.tailwind.cssVariables
|
||||||
? template(config.framework === 'nuxt' ? templates.NUXT_TAILWIND_CONFIG_WITH_VARIABLES : templates.TAILWIND_CONFIG_WITH_VARIABLES)({ extension })
|
? template(templates.TAILWIND_CONFIG_WITH_VARIABLES)({ extension, framework: config.framework })
|
||||||
: template(config.framework === 'nuxt' ? templates.NUXT_TAILWIND_CONFIG : templates.TAILWIND_CONFIG)({ extension }),
|
: template(templates.TAILWIND_CONFIG)({ extension, framework: config.framework }),
|
||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -260,7 +256,7 @@ export async function runInit(cwd: string, config: Config) {
|
||||||
// Write cn file.
|
// Write cn file.
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
`${config.resolvedPaths.utils}.${extension}`,
|
`${config.resolvedPaths.utils}.${extension}`,
|
||||||
extension === 'ts' ? templates.UTILS : templates.UTILS_JS,
|
extension === 'ts' ? templates.UTILS : await transformByDetype(templates.UTILS, '.ts'),
|
||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -270,12 +266,11 @@ export async function runInit(cwd: string, config: Config) {
|
||||||
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
||||||
const packageManager = await getPackageManager(cwd)
|
const packageManager = await getPackageManager(cwd)
|
||||||
|
|
||||||
// TODO: add support for other icon libraries.
|
|
||||||
const deps = PROJECT_DEPENDENCIES.base.concat(
|
const deps = PROJECT_DEPENDENCIES.base.concat(
|
||||||
config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : PROJECT_DEPENDENCIES.vue,
|
config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : [],
|
||||||
).concat(
|
).concat(
|
||||||
config.style === 'new-york' ? [] : ['lucide-vue-next'],
|
config.style === 'new-york' ? [] : ['lucide-vue-next'],
|
||||||
)
|
).filter(Boolean)
|
||||||
|
|
||||||
await execa(
|
await execa(
|
||||||
packageManager,
|
packageManager,
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,15 @@ import { resolveImport } from '@/src/utils/resolve-import'
|
||||||
export const DEFAULT_STYLE = 'default'
|
export const DEFAULT_STYLE = 'default'
|
||||||
export const DEFAULT_COMPONENTS = '@/components'
|
export const DEFAULT_COMPONENTS = '@/components'
|
||||||
export const DEFAULT_UTILS = '@/lib/utils'
|
export const DEFAULT_UTILS = '@/lib/utils'
|
||||||
export const DEFAULT_TAILWIND_CSS = 'src/assets/index.css'
|
|
||||||
export const DEFAULT_TAILWIND_CSS_NUXT = 'assets/style/tailwind.css'
|
|
||||||
export const DEFAULT_TAILWIND_CONFIG = 'tailwind.config.js'
|
export const DEFAULT_TAILWIND_CONFIG = 'tailwind.config.js'
|
||||||
export const DEFAULT_TAILWIND_BASE_COLOR = 'slate'
|
export const DEFAULT_TAILWIND_BASE_COLOR = 'slate'
|
||||||
|
|
||||||
|
export const TAILWIND_CSS_PATH = {
|
||||||
|
nuxt: 'assets/css/tailwind.css',
|
||||||
|
vite: 'src/assets/index.css',
|
||||||
|
laravel: 'resources/css/app.css',
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Figure out if we want to support all cosmiconfig formats.
|
// TODO: Figure out if we want to support all cosmiconfig formats.
|
||||||
// A simple components.json file would be nice.
|
// A simple components.json file would be nice.
|
||||||
const explorer = cosmiconfig('components', {
|
const explorer = cosmiconfig('components', {
|
||||||
|
|
@ -24,14 +28,14 @@ export const rawConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
$schema: z.string().optional(),
|
$schema: z.string().optional(),
|
||||||
style: z.string(),
|
style: z.string(),
|
||||||
typescript: z.boolean().default(false),
|
typescript: z.boolean().default(true),
|
||||||
tailwind: z.object({
|
tailwind: z.object({
|
||||||
config: z.string(),
|
config: z.string(),
|
||||||
css: z.string(),
|
css: z.string(),
|
||||||
baseColor: z.string(),
|
baseColor: z.string(),
|
||||||
cssVariables: z.boolean().default(true),
|
cssVariables: z.boolean().default(true),
|
||||||
}),
|
}),
|
||||||
framework: z.string(),
|
framework: z.string().default('Vite'),
|
||||||
aliases: z.object({
|
aliases: z.object({
|
||||||
components: z.string(),
|
components: z.string(),
|
||||||
utils: z.string(),
|
utils: z.string(),
|
||||||
|
|
@ -64,35 +68,40 @@ export async function getConfig(cwd: string) {
|
||||||
|
|
||||||
export async function resolveConfigPaths(cwd: string, config: RawConfig) {
|
export async function resolveConfigPaths(cwd: string, config: RawConfig) {
|
||||||
let tsConfig: ConfigLoaderResult | undefined
|
let tsConfig: ConfigLoaderResult | undefined
|
||||||
|
let tsConfigPath = path.resolve(
|
||||||
|
cwd,
|
||||||
|
config.framework === 'nuxt' ? '.nuxt/tsconfig.json' : './tsconfig.json',
|
||||||
|
)
|
||||||
|
|
||||||
if (config.typescript) {
|
if (config.typescript) {
|
||||||
const TSCONFIG_PATH = config.framework === 'nuxt' ? '.nuxt/tsconfig.json' : './tsconfig.json'
|
|
||||||
|
|
||||||
// Read tsconfig.json.
|
// Read tsconfig.json.
|
||||||
const tsconfigPath = path.resolve(cwd, TSCONFIG_PATH)
|
tsConfig = loadConfig(tsConfigPath)
|
||||||
tsConfig = loadConfig(tsconfigPath)
|
|
||||||
|
|
||||||
// In new Vue project, tsconfig has references to tsconfig.app.json, which is causing the path not resolving correctly
|
// In new Vue project, tsconfig has references to tsconfig.app.json, which is causing the path not resolving correctly
|
||||||
// If no paths were found, try to load tsconfig.app.json.
|
// If no paths were found, try to load tsconfig.app.json.
|
||||||
if ('paths' in tsConfig && Object.keys(tsConfig.paths).length === 0) {
|
if ('paths' in tsConfig && Object.keys(tsConfig.paths).length === 0) {
|
||||||
const FALLBACK_TSCONFIG_PATH = path.resolve(cwd, './tsconfig.app.json')
|
tsConfigPath = path.resolve(cwd, './tsconfig.app.json')
|
||||||
if (existsSync(FALLBACK_TSCONFIG_PATH))
|
if (existsSync(tsConfigPath))
|
||||||
tsConfig = loadConfig(FALLBACK_TSCONFIG_PATH)
|
tsConfig = loadConfig(tsConfigPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tsConfigPath = path.resolve(cwd, './jsconfig.json')
|
||||||
|
tsConfig = loadConfig(tsConfigPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsConfig.resultType === 'failed') {
|
if (tsConfig.resultType === 'failed') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to load tsconfig.json. ${tsConfig.message ?? ''}`.trim(),
|
`Failed to load ${tsConfigPath}. ${tsConfig.message ?? ''}`.trim(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return configSchema.parse({
|
return configSchema.parse({
|
||||||
...config,
|
...config,
|
||||||
resolvedPaths: {
|
resolvedPaths: {
|
||||||
tailwindConfig: path.resolve(cwd, config.tailwind.config),
|
tailwindConfig: path.resolve(cwd, config.tailwind.config),
|
||||||
tailwindCss: path.resolve(cwd, config.tailwind.css),
|
tailwindCss: path.resolve(cwd, config.tailwind.css),
|
||||||
utils: tsConfig ? await resolveImport(config.aliases.utils, tsConfig) : config.aliases.utils,
|
utils: resolveImport(config.aliases.utils, tsConfig),
|
||||||
components: tsConfig ? await resolveImport(config.aliases.components, tsConfig) : config.aliases.components,
|
components: resolveImport(config.aliases.components, tsConfig),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
import process from 'node:process'
|
||||||
import { HttpsProxyAgent } from 'https-proxy-agent'
|
import { HttpsProxyAgent } from 'https-proxy-agent'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import type * as z from 'zod'
|
import type * as z from 'zod'
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export function useEmitAsProps<Name extends string>(
|
||||||
const result: Record<string, any> = {}
|
const result: Record<string, any> = {}
|
||||||
if (!events?.length) {
|
if (!events?.length) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'No emitted event found. Please check component: \${vm?.type.__name}',
|
\`No emitted event found. Please check component: \${vm?.type.__name}\`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,37 +25,14 @@ export function useEmitAsProps<Name extends string>(
|
||||||
return result
|
return result
|
||||||
}`
|
}`
|
||||||
|
|
||||||
export const UTILS_JS = `import { clsx } from "clsx"
|
|
||||||
import { twMerge } from "tailwind-merge"
|
|
||||||
|
|
||||||
export function cn(...inputs) {
|
|
||||||
return twMerge(clsx(inputs))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useEmitAsProps(emit) {
|
|
||||||
const vm = getCurrentInstance()
|
|
||||||
|
|
||||||
const events = vm?.type.emits
|
|
||||||
const result = {}
|
|
||||||
if (!events?.length) {
|
|
||||||
console.warn(
|
|
||||||
'No emitted event found. Please check component: \${vm?.type.__name}',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
events?.forEach((ev) => {
|
|
||||||
result[toHandlerKey(camelize(ev))] = (...arg) => emit(ev, ...arg)
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
export const TAILWIND_CONFIG = `/** @type {import('tailwindcss').Config} */
|
export const TAILWIND_CONFIG = `/** @type {import('tailwindcss').Config} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
darkMode: ["class"],
|
darkMode: ["class"],
|
||||||
content: [
|
content: [
|
||||||
"./index.html",
|
'./pages/**/*.{<%- extension %>,<%- extension %>x}',
|
||||||
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
'./components/**/*.{<%- extension %>,<%- extension %>x}',
|
||||||
|
'./app/**/*.{<%- extension %>,<%- extension %>x}',
|
||||||
|
'./src/**/*.{<%- extension %>,<%- extension %>x}',
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
container: {
|
container: {
|
||||||
|
|
@ -88,112 +65,21 @@ module.exports = {
|
||||||
export const TAILWIND_CONFIG_WITH_VARIABLES = `/** @type {import('tailwindcss').Config} */
|
export const TAILWIND_CONFIG_WITH_VARIABLES = `/** @type {import('tailwindcss').Config} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
darkMode: ["class"],
|
darkMode: ["class"],
|
||||||
|
<% if (framework === 'vite') { %>
|
||||||
content: [
|
content: [
|
||||||
"./index.html",
|
'./pages/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
||||||
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
'./components/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
||||||
|
'./app/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
||||||
|
'./src/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
||||||
],
|
],
|
||||||
theme: {
|
<% } else if (framework === 'laravel') { %>
|
||||||
container: {
|
content: [
|
||||||
center: true,
|
"./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php",
|
||||||
padding: "2rem",
|
"./storage/framework/views/*.php",
|
||||||
screens: {
|
"./resources/views/**/*.blade.php",
|
||||||
"2xl": "1400px",
|
"./resources/js/**/*.{<%- extension %>,<%- extension %>x,vue}",
|
||||||
},
|
],
|
||||||
},
|
<% } %>
|
||||||
extend: {
|
|
||||||
colors: {
|
|
||||||
border: "hsl(var(--border))",
|
|
||||||
input: "hsl(var(--input))",
|
|
||||||
ring: "hsl(var(--ring))",
|
|
||||||
background: "hsl(var(--background))",
|
|
||||||
foreground: "hsl(var(--foreground))",
|
|
||||||
primary: {
|
|
||||||
DEFAULT: "hsl(var(--primary))",
|
|
||||||
foreground: "hsl(var(--primary-foreground))",
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
DEFAULT: "hsl(var(--secondary))",
|
|
||||||
foreground: "hsl(var(--secondary-foreground))",
|
|
||||||
},
|
|
||||||
destructive: {
|
|
||||||
DEFAULT: "hsl(var(--destructive))",
|
|
||||||
foreground: "hsl(var(--destructive-foreground))",
|
|
||||||
},
|
|
||||||
muted: {
|
|
||||||
DEFAULT: "hsl(var(--muted))",
|
|
||||||
foreground: "hsl(var(--muted-foreground))",
|
|
||||||
},
|
|
||||||
accent: {
|
|
||||||
DEFAULT: "hsl(var(--accent))",
|
|
||||||
foreground: "hsl(var(--accent-foreground))",
|
|
||||||
},
|
|
||||||
popover: {
|
|
||||||
DEFAULT: "hsl(var(--popover))",
|
|
||||||
foreground: "hsl(var(--popover-foreground))",
|
|
||||||
},
|
|
||||||
card: {
|
|
||||||
DEFAULT: "hsl(var(--card))",
|
|
||||||
foreground: "hsl(var(--card-foreground))",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
borderRadius: {
|
|
||||||
lg: "var(--radius)",
|
|
||||||
md: "calc(var(--radius) - 2px)",
|
|
||||||
sm: "calc(var(--radius) - 4px)",
|
|
||||||
},
|
|
||||||
keyframes: {
|
|
||||||
"accordion-down": {
|
|
||||||
from: { height: 0 },
|
|
||||||
to: { height: "var(--radix-accordion-content-height)" },
|
|
||||||
},
|
|
||||||
"accordion-up": {
|
|
||||||
from: { height: "var(--radix-accordion-content-height)" },
|
|
||||||
to: { height: 0 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
animation: {
|
|
||||||
"accordion-down": "accordion-down 0.2s ease-out",
|
|
||||||
"accordion-up": "accordion-up 0.2s ease-out",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [require("tailwindcss-animate")],
|
|
||||||
}`
|
|
||||||
|
|
||||||
export const NUXT_TAILWIND_CONFIG = `/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
darkMode: ["class"],
|
|
||||||
theme: {
|
|
||||||
container: {
|
|
||||||
center: true,
|
|
||||||
padding: "2rem",
|
|
||||||
screens: {
|
|
||||||
"2xl": "1400px",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
extend: {
|
|
||||||
keyframes: {
|
|
||||||
"accordion-down": {
|
|
||||||
from: { height: 0 },
|
|
||||||
to: { height: "var(--radix-accordion-content-height)" },
|
|
||||||
},
|
|
||||||
"accordion-up": {
|
|
||||||
from: { height: "var(--radix-accordion-content-height)" },
|
|
||||||
to: { height: 0 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
animation: {
|
|
||||||
"accordion-down": "accordion-down 0.2s ease-out",
|
|
||||||
"accordion-up": "accordion-up 0.2s ease-out",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [require("tailwindcss-animate")],
|
|
||||||
}`
|
|
||||||
|
|
||||||
export const NUXT_TAILWIND_CONFIG_WITH_VARIABLES = `/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
darkMode: ["class"],
|
|
||||||
theme: {
|
theme: {
|
||||||
container: {
|
container: {
|
||||||
center: true,
|
center: true,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import type * as z from 'zod'
|
||||||
import type { Config } from '@/src/utils/get-config'
|
import type { Config } from '@/src/utils/get-config'
|
||||||
import type { registryBaseColorSchema } from '@/src/utils/registry/schema'
|
import type { registryBaseColorSchema } from '@/src/utils/registry/schema'
|
||||||
import { transformCssVars } from '@/src/utils/transformers/transform-css-vars'
|
import { transformCssVars } from '@/src/utils/transformers/transform-css-vars'
|
||||||
|
import { transformImport } from '@/src/utils/transformers/transform-import'
|
||||||
|
import { transformSFC } from '@/src/utils/transformers/transform-sfc'
|
||||||
|
|
||||||
export interface TransformOpts {
|
export interface TransformOpts {
|
||||||
filename: string
|
filename: string
|
||||||
|
|
@ -22,6 +24,7 @@ export type Transformer<Output = SourceFile> = (
|
||||||
|
|
||||||
const transformers: Transformer[] = [
|
const transformers: Transformer[] = [
|
||||||
transformCssVars,
|
transformCssVars,
|
||||||
|
transformImport,
|
||||||
]
|
]
|
||||||
|
|
||||||
const project = new Project({
|
const project = new Project({
|
||||||
|
|
@ -36,14 +39,14 @@ async function createTempSourceFile(filename: string) {
|
||||||
export async function transform(opts: TransformOpts) {
|
export async function transform(opts: TransformOpts) {
|
||||||
const tempFile = await createTempSourceFile(opts.filename)
|
const tempFile = await createTempSourceFile(opts.filename)
|
||||||
const sourceFile = project.createSourceFile(tempFile, opts.raw, {
|
const sourceFile = project.createSourceFile(tempFile, opts.raw, {
|
||||||
scriptKind: ScriptKind.TSX,
|
scriptKind: ScriptKind.Unknown,
|
||||||
})
|
})
|
||||||
|
|
||||||
for (const transformer of transformers)
|
for (const transformer of transformers)
|
||||||
transformer({ sourceFile, ...opts })
|
transformer({ sourceFile, ...opts })
|
||||||
|
|
||||||
// return await transformJsx({
|
return await transformSFC({
|
||||||
// sourceFile,
|
sourceFile,
|
||||||
// ...opts,
|
...opts,
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,12 @@ export const transformCssVars: Transformer = async ({
|
||||||
|
|
||||||
sourceFile.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach((node) => {
|
sourceFile.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach((node) => {
|
||||||
const value = node.getText()
|
const value = node.getText()
|
||||||
if (value) {
|
|
||||||
|
if (value.includes('cn(')) {
|
||||||
|
const splitted = value.split('\'').map(i => applyColorMapping(i, baseColor.inlineColors))
|
||||||
|
node.replaceWithText(`${splitted.join('\'')}`)
|
||||||
|
}
|
||||||
|
else if (value) {
|
||||||
const valueWithColorMapping = applyColorMapping(
|
const valueWithColorMapping = applyColorMapping(
|
||||||
value.replace(/"/g, ''),
|
value.replace(/"/g, ''),
|
||||||
baseColor.inlineColors,
|
baseColor.inlineColors,
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,32 @@
|
||||||
import MagicString from 'magic-string'
|
import type { Transformer } from '@/src/utils/transformers'
|
||||||
import type { z } from 'zod'
|
|
||||||
import type { Config } from '../get-config'
|
|
||||||
import type { registryBaseColorSchema } from '../registry/schema'
|
|
||||||
|
|
||||||
export interface TransformOpts {
|
export const transformImport: Transformer = async ({ sourceFile, config }) => {
|
||||||
filename: string
|
const importDeclarations = sourceFile.getImportDeclarations()
|
||||||
raw: string
|
|
||||||
config: Config
|
for (const importDeclaration of importDeclarations) {
|
||||||
baseColor?: z.infer<typeof registryBaseColorSchema>
|
const moduleSpecifier = importDeclaration.getModuleSpecifierValue()
|
||||||
|
|
||||||
|
// Replace @/lib/registry/[style] with the components alias.
|
||||||
|
if (moduleSpecifier.startsWith('@/lib/registry/')) {
|
||||||
|
importDeclaration.setModuleSpecifier(
|
||||||
|
moduleSpecifier.replace(
|
||||||
|
/^@\/lib\/registry\/[^/]+/,
|
||||||
|
config.aliases.components,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace `import { cn } from "@/lib/utils"`
|
||||||
|
if (moduleSpecifier === '@/lib/utils') {
|
||||||
|
const namedImports = importDeclaration.getNamedImports()
|
||||||
|
const cnImport = namedImports.find(i => i.getName() === 'cn')
|
||||||
|
if (cnImport) {
|
||||||
|
importDeclaration.setModuleSpecifier(
|
||||||
|
moduleSpecifier.replace(/^@\/lib\/utils/, config.aliases.utils),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sourceFile
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformImport(content: string, config: Config) {
|
|
||||||
const s = new MagicString(content)
|
|
||||||
s.replaceAll(/@\/registry\/[^/]+/g, config.aliases.components)
|
|
||||||
s.replaceAll(/\$lib\/utils/g, config.aliases.utils)
|
|
||||||
return s.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
// export const transformImport: Transformer = async ({ sourceFile, config }) => {
|
|
||||||
// const importDeclarations = sourceFile.getImportDeclarations()
|
|
||||||
|
|
||||||
// for (const importDeclaration of importDeclarations) {
|
|
||||||
// const moduleSpecifier = importDeclaration.getModuleSpecifierValue()
|
|
||||||
|
|
||||||
// // Replace @/registry/[style] with the components alias.
|
|
||||||
// if (moduleSpecifier.startsWith('@/registry/')) {
|
|
||||||
// importDeclaration.setModuleSpecifier(
|
|
||||||
// moduleSpecifier.replace(
|
|
||||||
// /^@\/registry\/[^/]+/,
|
|
||||||
// config.aliases.components,
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Replace `import { cn } from "@/lib/utils"`
|
|
||||||
// if (moduleSpecifier === '@/lib/utils') {
|
|
||||||
// const namedImports = importDeclaration.getNamedImports()
|
|
||||||
// const cnImport = namedImports.find(i => i.getName() === 'cn')
|
|
||||||
// if (cnImport) {
|
|
||||||
// importDeclaration.setModuleSpecifier(
|
|
||||||
// moduleSpecifier.replace(/^@\/lib\/utils/, config.aliases.utils),
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return sourceFile
|
|
||||||
// }
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { createRequire } from 'node:module'
|
||||||
|
import type { Transformer } from '@/src/utils/transformers'
|
||||||
|
|
||||||
|
// required cause Error: Dynamic require of "@babel/core" is not supported
|
||||||
|
const require = createRequire(import.meta.url)
|
||||||
|
const { transform } = require('detype')
|
||||||
|
|
||||||
|
export async function transformByDetype(content: string, filename: string) {
|
||||||
|
return await transform(content, filename, {
|
||||||
|
removeTsComments: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const transformSFC: Transformer<string> = async ({ sourceFile, config }) => {
|
||||||
|
const output = sourceFile?.getFullText()
|
||||||
|
if (config?.typescript)
|
||||||
|
return output
|
||||||
|
|
||||||
|
return await transformByDetype(output, 'app.vue')
|
||||||
|
}
|
||||||
|
|
@ -63,7 +63,8 @@ test('init config-full', async () => {
|
||||||
expect(mockWriteFile).toHaveBeenNthCalledWith(
|
expect(mockWriteFile).toHaveBeenNthCalledWith(
|
||||||
3,
|
3,
|
||||||
expect.stringMatching(/src\/lib\/utils.ts$/),
|
expect.stringMatching(/src\/lib\/utils.ts$/),
|
||||||
expect.stringContaining('import { type ClassValue, clsx } from "clsx"'),
|
// eslint-disable-next-line @typescript-eslint/quotes
|
||||||
|
expect.stringContaining("import { type ClassValue, clsx } from 'clsx'"),
|
||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
expect(execa).toHaveBeenCalledWith(
|
expect(execa).toHaveBeenCalledWith(
|
||||||
|
|
@ -74,7 +75,6 @@ test('init config-full', async () => {
|
||||||
'class-variance-authority',
|
'class-variance-authority',
|
||||||
'clsx',
|
'clsx',
|
||||||
'tailwind-merge',
|
'tailwind-merge',
|
||||||
'@radix-ui/react-icons',
|
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
cwd: targetDir,
|
cwd: targetDir,
|
||||||
|
|
@ -133,7 +133,8 @@ test('init config-partial', async () => {
|
||||||
expect(mockWriteFile).toHaveBeenNthCalledWith(
|
expect(mockWriteFile).toHaveBeenNthCalledWith(
|
||||||
3,
|
3,
|
||||||
expect.stringMatching(/utils.ts$/),
|
expect.stringMatching(/utils.ts$/),
|
||||||
expect.stringContaining('import { type ClassValue, clsx } from "clsx"'),
|
// eslint-disable-next-line @typescript-eslint/quotes
|
||||||
|
expect.stringContaining("import { type ClassValue, clsx } from 'clsx'"),
|
||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
expect(execa).toHaveBeenCalledWith(
|
expect(execa).toHaveBeenCalledWith(
|
||||||
|
|
@ -144,7 +145,7 @@ test('init config-partial', async () => {
|
||||||
'class-variance-authority',
|
'class-variance-authority',
|
||||||
'clsx',
|
'clsx',
|
||||||
'tailwind-merge',
|
'tailwind-merge',
|
||||||
'lucide-react',
|
'lucide-vue-next',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
cwd: targetDir,
|
cwd: targetDir,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{
|
||||||
"style": "default",
|
"style": "new-york",
|
||||||
"tailwind": {
|
"tailwind": {
|
||||||
"config": "tailwind.config.ts",
|
"config": "tailwind.config.ts",
|
||||||
"css": "src/app/globals.css",
|
"css": "src/app/globals.css",
|
||||||
"baseColor": "zinc",
|
"baseColor": "zinc",
|
||||||
"cssVariables": true
|
"cssVariables": true
|
||||||
},
|
},
|
||||||
"rsc": false,
|
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"utils": "~/lib/utils",
|
"utils": "~/lib/utils",
|
||||||
"components": "~/components"
|
"components": "~/components"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "test-cli-config-full",
|
"name": "test-cli-config-full",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"author": "shadcn",
|
"author": "shadcn",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"main": "index.js"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "test-cli-config-invalid",
|
"name": "test-cli-config-invalid",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"author": "shadcn",
|
"author": "shadcn",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"main": "index.js"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"style": "default",
|
"style": "default",
|
||||||
"tsx": false,
|
|
||||||
"tailwind": {
|
"tailwind": {
|
||||||
"config": "./tailwind.config.js",
|
"config": "./tailwind.config.js",
|
||||||
"css": "./src/assets/css/tailwind.css",
|
"css": "./src/assets/css/tailwind.css",
|
||||||
|
|
@ -10,5 +9,6 @@
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"utils": "@/lib/utils",
|
"utils": "@/lib/utils",
|
||||||
"components": "@/components"
|
"components": "@/components"
|
||||||
}
|
},
|
||||||
|
"typescript": false
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "test-cli-config-partial",
|
"name": "test-cli-config-partial",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"author": "shadcn",
|
"author": "shadcn",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"main": "index.js"
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "test-cli-config-none",
|
"name": "test-cli-config-none",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"author": "shadcn",
|
"author": "shadcn",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"main": "index.js"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "test-cli-config-partial",
|
"name": "test-cli-config-partial",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"author": "shadcn",
|
"author": "shadcn",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"main": "index.js"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
packages/cli/test/fixtures/nuxt/.gitignore
vendored
Normal file
24
packages/cli/test/fixtures/nuxt/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Nuxt dev/build outputs
|
||||||
|
.output
|
||||||
|
.data
|
||||||
|
.nuxt
|
||||||
|
.nitro
|
||||||
|
.cache
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
.DS_Store
|
||||||
|
.fleet
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Local env files
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
1
packages/cli/test/fixtures/nuxt/.npmrc
vendored
Normal file
1
packages/cli/test/fixtures/nuxt/.npmrc
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
shamefully-hoist=true
|
||||||
75
packages/cli/test/fixtures/nuxt/README.md
vendored
Normal file
75
packages/cli/test/fixtures/nuxt/README.md
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
# Nuxt 3 Minimal Starter
|
||||||
|
|
||||||
|
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Make sure to install the dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Server
|
||||||
|
|
||||||
|
Start the development server on `http://localhost:3000`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm run dev
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn dev
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Production
|
||||||
|
|
||||||
|
Build the application for production:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm run build
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run build
|
||||||
|
```
|
||||||
|
|
||||||
|
Locally preview production build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run preview
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm run preview
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn preview
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run preview
|
||||||
|
```
|
||||||
|
|
||||||
|
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
||||||
28
packages/cli/test/fixtures/nuxt/app.vue
vendored
Normal file
28
packages/cli/test/fixtures/nuxt/app.vue
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<UiButton :variant="'secondary'" :size="'lg'">
|
||||||
|
Save
|
||||||
|
</UiButton>
|
||||||
|
|
||||||
|
<UiAlertDialog>
|
||||||
|
<UiAlertDialogTrigger as-child>
|
||||||
|
<UiButton variant="outline">
|
||||||
|
Show Dialog
|
||||||
|
</UiButton>
|
||||||
|
</UiAlertDialogTrigger>
|
||||||
|
<UiAlertDialogContent>
|
||||||
|
<UiAlertDialogHeader>
|
||||||
|
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
||||||
|
<UiAlertDialogDescription>
|
||||||
|
This action cannot be undone. This will permanently delete your
|
||||||
|
account and remove your data from our servers.
|
||||||
|
</UiAlertDialogDescription>
|
||||||
|
</UiAlertDialogHeader>
|
||||||
|
<UiAlertDialogFooter>
|
||||||
|
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
||||||
|
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
||||||
|
</UiAlertDialogFooter>
|
||||||
|
</UiAlertDialogContent>
|
||||||
|
</UiAlertDialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
78
packages/cli/test/fixtures/nuxt/assets/css/tailwind.css
vendored
Normal file
78
packages/cli/test/fixtures/nuxt/assets/css/tailwind.css
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
:root {
|
||||||
|
--background: 0 0% 100%;
|
||||||
|
--foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--muted: 210 40% 96.1%;
|
||||||
|
--muted-foreground: 215.4 16.3% 46.9%;
|
||||||
|
|
||||||
|
--popover: 0 0% 100%;
|
||||||
|
--popover-foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--card: 0 0% 100%;
|
||||||
|
--card-foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--border: 214.3 31.8% 91.4%;
|
||||||
|
--input: 214.3 31.8% 91.4%;
|
||||||
|
|
||||||
|
--primary: 222.2 47.4% 11.2%;
|
||||||
|
--primary-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--secondary: 210 40% 96.1%;
|
||||||
|
--secondary-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--accent: 210 40% 96.1%;
|
||||||
|
--accent-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--destructive: 0 84.2% 60.2%;
|
||||||
|
--destructive-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--ring: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: 222.2 84% 4.9%;
|
||||||
|
--foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--muted: 217.2 32.6% 17.5%;
|
||||||
|
--muted-foreground: 215 20.2% 65.1%;
|
||||||
|
|
||||||
|
--popover: 222.2 84% 4.9%;
|
||||||
|
--popover-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--card: 222.2 84% 4.9%;
|
||||||
|
--card-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--border: 217.2 32.6% 17.5%;
|
||||||
|
--input: 217.2 32.6% 17.5%;
|
||||||
|
|
||||||
|
--primary: 210 40% 98%;
|
||||||
|
--primary-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--secondary: 217.2 32.6% 17.5%;
|
||||||
|
--secondary-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--accent: 217.2 32.6% 17.5%;
|
||||||
|
--accent-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--destructive: 0 62.8% 30.6%;
|
||||||
|
--destructive-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--ring: 212.7 26.8% 83.9%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/cli/test/fixtures/nuxt/components.json
vendored
Normal file
15
packages/cli/test/fixtures/nuxt/components.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"style": "default",
|
||||||
|
"typescript": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "tailwind.config.js",
|
||||||
|
"css": "assets/css/tailwind.css",
|
||||||
|
"baseColor": "slate",
|
||||||
|
"cssVariables": true
|
||||||
|
},
|
||||||
|
"framework": "nuxt",
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"utils": "@/lib/utils"
|
||||||
|
}
|
||||||
|
}
|
||||||
16
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue
vendored
Normal file
16
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { type AlertDialogEmits, type AlertDialogProps, AlertDialogRoot } from 'radix-vue'
|
||||||
|
import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogProps>()
|
||||||
|
|
||||||
|
const emits = defineEmits<AlertDialogEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogRoot v-bind="{ ...props, ...emitsAsProps }">
|
||||||
|
<slot />
|
||||||
|
</AlertDialogRoot>
|
||||||
|
</template>
|
||||||
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue
vendored
Normal file
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AlertDialogAction, type AlertDialogActionProps } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { buttonVariants } from '@/components/ui/button'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogActionProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogAction v-bind="props" :class="cn(buttonVariants(), $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</AlertDialogAction>
|
||||||
|
</template>
|
||||||
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue
vendored
Normal file
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AlertDialogCancel, type AlertDialogCancelProps } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { buttonVariants } from '@/components/ui/button'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogCancelProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogCancel v-bind="props" :class="cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', $attrs.class ?? '')">
|
||||||
|
<slot />
|
||||||
|
</AlertDialogCancel>
|
||||||
|
</template>
|
||||||
35
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue
vendored
Normal file
35
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
AlertDialogContent,
|
||||||
|
type AlertDialogContentEmits,
|
||||||
|
type AlertDialogContentProps,
|
||||||
|
AlertDialogOverlay,
|
||||||
|
AlertDialogPortal,
|
||||||
|
} from 'radix-vue'
|
||||||
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogContentProps & { class?: string }>()
|
||||||
|
|
||||||
|
const emits = defineEmits<AlertDialogContentEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogPortal>
|
||||||
|
<AlertDialogOverlay
|
||||||
|
class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
||||||
|
/>
|
||||||
|
<AlertDialogContent
|
||||||
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
|
:class="
|
||||||
|
cn(
|
||||||
|
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full',
|
||||||
|
props.class,
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialogPortal>
|
||||||
|
</template>
|
||||||
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue
vendored
Normal file
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
AlertDialogDescription,
|
||||||
|
type AlertDialogDescriptionProps,
|
||||||
|
} from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogDescriptionProps & { class?: string }>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogDescription
|
||||||
|
:class="cn('text-muted-foreground text-sm', props.class)"
|
||||||
|
:as-child="props.asChild"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</template>
|
||||||
23
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue
vendored
Normal file
23
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
class: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
:class="
|
||||||
|
cn(
|
||||||
|
'flex flex-col space-y-2 sm:space-y-0 mt-3.5 sm:flex-row sm:justify-end sm:space-x-2',
|
||||||
|
props.class,
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue
vendored
Normal file
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
class: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
:class="cn('flex flex-col space-y-2 text-center sm:text-left', props.class)"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
15
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue
vendored
Normal file
15
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AlertDialogTitle, type AlertDialogTitleProps } from 'radix-vue'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogTitleProps & { class?: string }>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogTitle
|
||||||
|
:as-child="props.asChild"
|
||||||
|
:class="cn('text-lg text-foreground font-semibold', props.class)"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</AlertDialogTitle>
|
||||||
|
</template>
|
||||||
11
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue
vendored
Normal file
11
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AlertDialogTrigger, type AlertDialogTriggerProps } from 'radix-vue'
|
||||||
|
|
||||||
|
const props = defineProps<AlertDialogTriggerProps>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AlertDialogTrigger v-bind="props">
|
||||||
|
<slot />
|
||||||
|
</AlertDialogTrigger>
|
||||||
|
</template>
|
||||||
9
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts
vendored
Normal file
9
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
export { default as AlertDialog } from './AlertDialog.vue'
|
||||||
|
export { default as AlertDialogTrigger } from './AlertDialogTrigger.vue'
|
||||||
|
export { default as AlertDialogContent } from './AlertDialogContent.vue'
|
||||||
|
export { default as AlertDialogHeader } from './AlertDialogHeader.vue'
|
||||||
|
export { default as AlertDialogTitle } from './AlertDialogTitle.vue'
|
||||||
|
export { default as AlertDialogDescription } from './AlertDialogDescription.vue'
|
||||||
|
export { default as AlertDialogFooter } from './AlertDialogFooter.vue'
|
||||||
|
export { default as AlertDialogAction } from './AlertDialogAction.vue'
|
||||||
|
export { default as AlertDialogCancel } from './AlertDialogCancel.vue'
|
||||||
23
packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue
vendored
Normal file
23
packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { buttonVariants } from '.'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
variant?: NonNullable<Parameters<typeof buttonVariants>[0]>['variant']
|
||||||
|
size?: NonNullable<Parameters<typeof buttonVariants>[0]>['size']
|
||||||
|
as?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
as: 'button',
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="as"
|
||||||
|
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user