From 71ab613c4c94856986ce78bf0ab210f440b9d55e Mon Sep 17 00:00:00 2001
From: imkhoat
Date: Sat, 22 Jun 2024 16:15:12 +0700
Subject: [PATCH] feat(separator): add label props on separator component
---
.../theme/components/theming/utils/data.ts | 10 ++++----
.../src/content/docs/components/separator.md | 2 +-
.../www/src/content/docs/installation/vite.md | 24 +++++++++----------
.../forms/components/NotificationsForm.vue | 2 +-
.../default/example/ComboboxPopover.vue | 2 +-
.../default/example/SeparatorDemo.vue | 2 +-
.../default/ui/separator/Separator.vue | 21 +++++++++++++---
.../new-york/example/SeparatorDemo.vue | 2 +-
.../new-york/ui/separator/Separator.vue | 24 ++++++++++++++++---
9 files changed, 61 insertions(+), 28 deletions(-)
diff --git a/apps/www/.vitepress/theme/components/theming/utils/data.ts b/apps/www/.vitepress/theme/components/theming/utils/data.ts
index 1ef53ce0..41166bad 100644
--- a/apps/www/.vitepress/theme/components/theming/utils/data.ts
+++ b/apps/www/.vitepress/theme/components/theming/utils/data.ts
@@ -32,11 +32,11 @@ export const allColors: Color[] = [
'violet',
]
-interface Payment {
- status: string
- email: string
- amount: number
-}
+// interface Payment {
+// status: string
+// email: string
+// amount: number
+// }
interface TeamMember {
name: string
diff --git a/apps/www/src/content/docs/components/separator.md b/apps/www/src/content/docs/components/separator.md
index 898bc9c8..eca5a6c3 100644
--- a/apps/www/src/content/docs/components/separator.md
+++ b/apps/www/src/content/docs/components/separator.md
@@ -44,6 +44,6 @@ import { Separator } from '@/components/ui/separator'
-
+
```
diff --git a/apps/www/src/content/docs/installation/vite.md b/apps/www/src/content/docs/installation/vite.md
index c72d9abc..97011ae0 100644
--- a/apps/www/src/content/docs/installation/vite.md
+++ b/apps/www/src/content/docs/installation/vite.md
@@ -45,12 +45,12 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co
#### `vite.config`
```typescript {5,6,9-13}
- import path from "path"
- import { defineConfig } from "vite"
- import vue from "@vitejs/plugin-vue"
+ import path from 'node:path'
+ import { defineConfig } from 'vite'
+ import vue from '@vitejs/plugin-vue'
- import tailwind from "tailwindcss"
- import autoprefixer from "autoprefixer"
+ import tailwind from 'tailwindcss'
+ import autoprefixer from 'autoprefixer'
export default defineConfig({
css: {
@@ -61,7 +61,7 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co
plugins: [vue()],
resolve: {
alias: {
- "@": path.resolve(__dirname, "./src"),
+ '@': path.resolve(__dirname, './src'),
},
},
})
@@ -116,12 +116,12 @@ npm i -D @types/node
```
```typescript {15-19}
-import path from "path"
-import vue from "@vitejs/plugin-vue"
-import { defineConfig } from "vite"
+import path from 'node:path'
+import vue from '@vitejs/plugin-vue'
+import { defineConfig } from 'vite'
-import tailwind from "tailwindcss"
-import autoprefixer from "autoprefixer"
+import tailwind from 'tailwindcss'
+import autoprefixer from 'autoprefixer'
export default defineConfig({
css: {
@@ -132,7 +132,7 @@ export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
- "@": path.resolve(__dirname, "./src"),
+ '@': path.resolve(__dirname, './src'),
},
},
})
diff --git a/apps/www/src/examples/forms/components/NotificationsForm.vue b/apps/www/src/examples/forms/components/NotificationsForm.vue
index 62fefdc4..8de14db9 100644
--- a/apps/www/src/examples/forms/components/NotificationsForm.vue
+++ b/apps/www/src/examples/forms/components/NotificationsForm.vue
@@ -33,7 +33,7 @@ const { handleSubmit } = useForm({
},
})
-const onSubmit = handleSubmit((values, { resetForm }) => {
+const onSubmit = handleSubmit((values) => {
toast({
title: 'You submitted the following values:',
description: h('pre', { class: 'mt-2 w-[340px] rounded-md bg-slate-950 p-4' }, h('code', { class: 'text-white' }, JSON.stringify(values, null, 2))),
diff --git a/apps/www/src/lib/registry/default/example/ComboboxPopover.vue b/apps/www/src/lib/registry/default/example/ComboboxPopover.vue
index 4686e4ce..dc2f25a2 100644
--- a/apps/www/src/lib/registry/default/example/ComboboxPopover.vue
+++ b/apps/www/src/lib/registry/default/example/ComboboxPopover.vue
@@ -60,7 +60,7 @@ const statuses: Status[] = [
]
const open = ref(false)
-const value = ref()
+// const value = ref()
const selectedStatus = ref()
diff --git a/apps/www/src/lib/registry/default/example/SeparatorDemo.vue b/apps/www/src/lib/registry/default/example/SeparatorDemo.vue
index ddd29560..c16acdba 100644
--- a/apps/www/src/lib/registry/default/example/SeparatorDemo.vue
+++ b/apps/www/src/lib/registry/default/example/SeparatorDemo.vue
@@ -12,7 +12,7 @@ import { Separator } from '@/lib/registry/default/ui/separator'
An open-source UI component library.
-
+
Blog
diff --git a/apps/www/src/lib/registry/default/ui/separator/Separator.vue b/apps/www/src/lib/registry/default/ui/separator/Separator.vue
index 791626c2..7edae0dd 100644
--- a/apps/www/src/lib/registry/default/ui/separator/Separator.vue
+++ b/apps/www/src/lib/registry/default/ui/separator/Separator.vue
@@ -3,7 +3,9 @@ import { type HTMLAttributes, computed } from 'vue'
import { Separator, type SeparatorProps } from 'radix-vue'
import { cn } from '@/lib/utils'
-const props = defineProps
()
+const props = defineProps<
+ SeparatorProps & { class?: HTMLAttributes['class'], label?: string }
+>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
@@ -15,6 +17,19 @@ const delegatedProps = computed(() => {
+ :class="
+ cn(
+ 'shrink-0 bg-border relative',
+ props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',
+ props.class,
+ )
+ "
+ >
+ {{ props.label }}
+
diff --git a/apps/www/src/lib/registry/new-york/example/SeparatorDemo.vue b/apps/www/src/lib/registry/new-york/example/SeparatorDemo.vue
index 7e4f2f3e..7e6483b0 100644
--- a/apps/www/src/lib/registry/new-york/example/SeparatorDemo.vue
+++ b/apps/www/src/lib/registry/new-york/example/SeparatorDemo.vue
@@ -12,7 +12,7 @@ import { Separator } from '@/lib/registry/new-york/ui/separator'
An open-source UI component library.
-
+
Blog
diff --git a/apps/www/src/lib/registry/new-york/ui/separator/Separator.vue b/apps/www/src/lib/registry/new-york/ui/separator/Separator.vue
index 791626c2..10807da8 100644
--- a/apps/www/src/lib/registry/new-york/ui/separator/Separator.vue
+++ b/apps/www/src/lib/registry/new-york/ui/separator/Separator.vue
@@ -3,7 +3,9 @@ import { type HTMLAttributes, computed } from 'vue'
import { Separator, type SeparatorProps } from 'radix-vue'
import { cn } from '@/lib/utils'
-const props = defineProps
()
+const props = defineProps<
+ SeparatorProps & { class?: HTMLAttributes['class'], label?: string }
+>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
@@ -15,6 +17,22 @@ const delegatedProps = computed(() => {
+ :class="
+ cn(
+ 'shrink-0 bg-border relative',
+ props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',
+ props.class,
+ )
+ "
+ >
+ {{ props.label }}
+