Skip to content

Commit f597d25

Browse files
authoredJun 23, 2024··
feat(separator): add label props on separator component (#626)
1 parent eeca60d commit f597d25

File tree

11 files changed

+63
-30
lines changed

11 files changed

+63
-30
lines changed
 

‎apps/www/.vitepress/theme/components/theming/utils/data.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export const allColors: Color[] = [
3232
'violet',
3333
]
3434

35-
interface Payment {
36-
status: string
37-
email: string
38-
amount: number
39-
}
35+
// interface Payment {
36+
// status: string
37+
// email: string
38+
// amount: number
39+
// }
4040

4141
interface TeamMember {
4242
name: string

‎apps/www/src/content/docs/components/separator.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ import { Separator } from '@/components/ui/separator'
4444
</script>
4545
4646
<template>
47-
<Separator />
47+
<Separator label="Or" />
4848
</template>
4949
```

‎apps/www/src/content/docs/installation/vite.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co
4545
#### `vite.config`
4646

4747
```typescript {5,6,9-13}
48-
import path from "path"
49-
import { defineConfig } from "vite"
50-
import vue from "@vitejs/plugin-vue"
48+
import path from 'node:path'
49+
import { defineConfig } from 'vite'
50+
import vue from '@vitejs/plugin-vue'
5151

52-
import tailwind from "tailwindcss"
53-
import autoprefixer from "autoprefixer"
52+
import tailwind from 'tailwindcss'
53+
import autoprefixer from 'autoprefixer'
5454

5555
export default defineConfig({
5656
css: {
@@ -61,7 +61,7 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co
6161
plugins: [vue()],
6262
resolve: {
6363
alias: {
64-
"@": path.resolve(__dirname, "./src"),
64+
'@': path.resolve(__dirname, './src'),
6565
},
6666
},
6767
})
@@ -116,12 +116,12 @@ npm i -D @types/node
116116
```
117117

118118
```typescript {15-19}
119-
import path from "path"
120-
import vue from "@vitejs/plugin-vue"
121-
import { defineConfig } from "vite"
119+
import path from 'node:path'
120+
import vue from '@vitejs/plugin-vue'
121+
import { defineConfig } from 'vite'
122122

123-
import tailwind from "tailwindcss"
124-
import autoprefixer from "autoprefixer"
123+
import tailwind from 'tailwindcss'
124+
import autoprefixer from 'autoprefixer'
125125

126126
export default defineConfig({
127127
css: {
@@ -132,7 +132,7 @@ export default defineConfig({
132132
plugins: [vue()],
133133
resolve: {
134134
alias: {
135-
"@": path.resolve(__dirname, "./src"),
135+
'@': path.resolve(__dirname, './src'),
136136
},
137137
},
138138
})

‎apps/www/src/examples/forms/components/NotificationsForm.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const { handleSubmit } = useForm({
3333
},
3434
})
3535
36-
const onSubmit = handleSubmit((values, { resetForm }) => {
36+
const onSubmit = handleSubmit((values) => {
3737
toast({
3838
title: 'You submitted the following values:',
3939
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))),

‎apps/www/src/lib/registry/default/example/ComboboxPopover.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const statuses: Status[] = [
6060
]
6161
6262
const open = ref(false)
63-
const value = ref<typeof statuses[number]>()
63+
// const value = ref<typeof statuses[number]>()
6464
6565
const selectedStatus = ref<Status>()
6666
</script>

‎apps/www/src/lib/registry/default/example/SeparatorDemo.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Separator } from '@/lib/registry/default/ui/separator'
1212
An open-source UI component library.
1313
</p>
1414
</div>
15-
<Separator class="my-4" />
15+
<Separator class="my-4" label="Or" />
1616
<div class="flex h-5 items-center space-x-4 text-sm">
1717
<div>Blog</div>
1818
<Separator orientation="vertical" />

‎apps/www/src/lib/registry/default/ui/separator/Separator.vue

+18-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { type HTMLAttributes, computed } from 'vue'
33
import { Separator, type SeparatorProps } from 'radix-vue'
44
import { cn } from '@/lib/utils'
55
6-
const props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()
6+
const props = defineProps<
7+
SeparatorProps & { class?: HTMLAttributes['class'], label?: string }
8+
>()
79
810
const delegatedProps = computed(() => {
911
const { class: _, ...delegated } = props
@@ -15,6 +17,19 @@ const delegatedProps = computed(() => {
1517
<template>
1618
<Separator
1719
v-bind="delegatedProps"
18-
:class="cn('shrink-0 bg-border', props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full', props.class)"
19-
/>
20+
:class="
21+
cn(
22+
'shrink-0 bg-border relative',
23+
props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',
24+
props.class,
25+
)
26+
"
27+
>
28+
<span
29+
v-if="props.label"
30+
:class="cn('text-xs text-muted-foreground bg-background absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white flex justify-center items-center',
31+
props.orientation === 'vertical' ? 'w-[1px] px-1 py-2' : 'h-[1px] py-1 px-2',
32+
)"
33+
>{{ props.label }}</span>
34+
</Separator>
2035
</template>

‎apps/www/src/lib/registry/new-york/example/SeparatorDemo.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Separator } from '@/lib/registry/new-york/ui/separator'
1212
An open-source UI component library.
1313
</p>
1414
</div>
15-
<Separator class="my-4" />
15+
<Separator class="my-4" label="Or" />
1616
<div class="flex h-5 items-center space-x-4 text-sm">
1717
<div>Blog</div>
1818
<Separator orientation="vertical" />

‎apps/www/src/lib/registry/new-york/ui/separator/Separator.vue

+21-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { type HTMLAttributes, computed } from 'vue'
33
import { Separator, type SeparatorProps } from 'radix-vue'
44
import { cn } from '@/lib/utils'
55
6-
const props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()
6+
const props = defineProps<
7+
SeparatorProps & { class?: HTMLAttributes['class'], label?: string }
8+
>()
79
810
const delegatedProps = computed(() => {
911
const { class: _, ...delegated } = props
@@ -15,6 +17,22 @@ const delegatedProps = computed(() => {
1517
<template>
1618
<Separator
1719
v-bind="delegatedProps"
18-
:class="cn('shrink-0 bg-border', props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full', props.class)"
19-
/>
20+
:class="
21+
cn(
22+
'shrink-0 bg-border relative',
23+
props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',
24+
props.class,
25+
)
26+
"
27+
>
28+
<span
29+
v-if="props.label"
30+
:class="
31+
cn(
32+
'text-xs text-muted-foreground bg-background absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white flex justify-center items-center',
33+
props.orientation === 'vertical' ? 'w-[1px] px-1 py-2' : 'h-[1px] py-1 px-2',
34+
)
35+
"
36+
>{{ props.label }}</span>
37+
</Separator>
2038
</template>

‎apps/www/src/public/registry/styles/default/separator.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"files": [
88
{
99
"name": "Separator.vue",
10-
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport { Separator, type SeparatorProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n</script>\n\n<template>\n <Separator\n v-bind=\"delegatedProps\"\n :class=\"cn('shrink-0 bg-border', props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full', props.class)\"\n />\n</template>\n"
10+
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport { Separator, type SeparatorProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<\n SeparatorProps & { class?: HTMLAttributes['class'], label?: string }\n>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n</script>\n\n<template>\n <Separator\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'shrink-0 bg-border relative',\n props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',\n props.class,\n )\n \"\n >\n <span\n v-if=\"props.label\"\n :class=\"cn('text-xs text-muted-foreground bg-background absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white flex justify-center items-center',\n props.orientation === 'vertical' ? 'w-[1px] px-1 py-2' : 'h-[1px] py-1 px-2',\n )\"\n >{{ props.label }}</span>\n </Separator>\n</template>\n"
1111
},
1212
{
1313
"name": "index.ts",

‎apps/www/src/public/registry/styles/new-york/separator.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"files": [
88
{
99
"name": "Separator.vue",
10-
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport { Separator, type SeparatorProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n</script>\n\n<template>\n <Separator\n v-bind=\"delegatedProps\"\n :class=\"cn('shrink-0 bg-border', props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full', props.class)\"\n />\n</template>\n"
10+
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport { Separator, type SeparatorProps } from 'radix-vue'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<\n SeparatorProps & { class?: HTMLAttributes['class'], label?: string }\n>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n</script>\n\n<template>\n <Separator\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'shrink-0 bg-border relative',\n props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',\n props.class,\n )\n \"\n >\n <span\n v-if=\"props.label\"\n :class=\"\n cn(\n 'text-xs text-muted-foreground bg-background absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white flex justify-center items-center',\n props.orientation === 'vertical' ? 'w-[1px] px-1 py-2' : 'h-[1px] py-1 px-2',\n )\n \"\n >{{ props.label }}</span>\n </Separator>\n</template>\n"
1111
},
1212
{
1313
"name": "index.ts",

0 commit comments

Comments
 (0)
Please sign in to comment.