mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
docs: fix vue example
This commit is contained in:
31
examples/nuxt-example/components/ui/stepper/Stepper.vue
Normal file
31
examples/nuxt-example/components/ui/stepper/Stepper.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperRootEmits, StepperRootProps } from 'radix-vue'
|
||||
import { StepperRoot, useForwardPropsEmits } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<StepperRootEmits>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperRoot
|
||||
v-slot="slotProps"
|
||||
:class="cn(
|
||||
'flex gap-2',
|
||||
props.class,
|
||||
)"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</StepperRoot>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperDescriptionProps } from 'radix-vue'
|
||||
import { StepperDescription, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperDescriptionProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperDescription v-slot="slotProps" v-bind="forwarded" :class="cn('text-xs text-muted-foreground', props.class)">
|
||||
<slot v-bind="slotProps" />
|
||||
</StepperDescription>
|
||||
</template>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperIndicatorProps } from 'radix-vue'
|
||||
import { StepperIndicator, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperIndicatorProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperIndicator
|
||||
v-bind="forwarded"
|
||||
:class="cn(
|
||||
'inline-flex items-center justify-center rounded-full text-muted-foreground/50 w-8 h-8',
|
||||
// Disabled
|
||||
'group-data-[disabled]:text-muted-foreground group-data-[disabled]:opacity-50',
|
||||
// Active
|
||||
'group-data-[state=active]:bg-primary group-data-[state=active]:text-primary-foreground',
|
||||
// Completed
|
||||
'group-data-[state=completed]:bg-accent group-data-[state=completed]:text-accent-foreground',
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
<slot />
|
||||
</StepperIndicator>
|
||||
</template>
|
||||
27
examples/nuxt-example/components/ui/stepper/StepperItem.vue
Normal file
27
examples/nuxt-example/components/ui/stepper/StepperItem.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperItemProps } from 'radix-vue'
|
||||
import { StepperItem, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperItemProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperItem
|
||||
v-slot="slotProps"
|
||||
v-bind="forwarded"
|
||||
:class="cn('flex items-center gap-2 group data-[disabled]:pointer-events-none', props.class)"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</StepperItem>
|
||||
</template>
|
||||
@@ -0,0 +1,31 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperSeparatorProps } from 'radix-vue'
|
||||
import { StepperSeparator, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperSeparatorProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperSeparator
|
||||
v-bind="forwarded"
|
||||
:class="cn(
|
||||
'bg-muted',
|
||||
// Disabled
|
||||
'group-data-[disabled]:bg-muted group-data-[disabled]:opacity-50',
|
||||
// Completed
|
||||
'group-data-[state=completed]:bg-accent-foreground',
|
||||
props.class,
|
||||
)"
|
||||
/>
|
||||
</template>
|
||||
23
examples/nuxt-example/components/ui/stepper/StepperTitle.vue
Normal file
23
examples/nuxt-example/components/ui/stepper/StepperTitle.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperTitleProps } from 'radix-vue'
|
||||
import { StepperTitle, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperTitleProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperTitle v-bind="forwarded" :class="cn('text-md font-semibold whitespace-nowrap', props.class)">
|
||||
<slot />
|
||||
</StepperTitle>
|
||||
</template>
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts" setup>
|
||||
import { type HTMLAttributes, computed } from 'vue'
|
||||
import type { StepperTriggerProps } from 'radix-vue'
|
||||
import { StepperTrigger, useForwardProps } from 'radix-vue'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<StepperTriggerProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, ...delegated } = props
|
||||
|
||||
return delegated
|
||||
})
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StepperTrigger
|
||||
v-bind="forwarded"
|
||||
:class="cn('p-1 flex flex-col items-center text-center gap-1 rounded-md', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</StepperTrigger>
|
||||
</template>
|
||||
7
examples/nuxt-example/components/ui/stepper/index.ts
Normal file
7
examples/nuxt-example/components/ui/stepper/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export { default as Stepper } from './Stepper.vue'
|
||||
export { default as StepperItem } from './StepperItem.vue'
|
||||
export { default as StepperIndicator } from './StepperIndicator.vue'
|
||||
export { default as StepperTrigger } from './StepperTrigger.vue'
|
||||
export { default as StepperTitle } from './StepperTitle.vue'
|
||||
export { default as StepperDescription } from './StepperDescription.vue'
|
||||
export { default as StepperSeparator } from './StepperSeparator.vue'
|
||||
Reference in New Issue
Block a user