gaoluyang
2026-06-24 c0cb161bb52ce0fbdce5c66ec391d107c75e2452
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script setup lang="ts" generic="Type extends 'text' | 'number' = 'text'">
import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui';
 
import type { HTMLAttributes } from 'vue';
 
import { cn } from '..\..\..\..\..\base\shared\src\utils';
 
import { reactiveOmit } from '@vueuse/core';
import { PinInputRoot, useForwardPropsEmits } from 'reka-ui';
 
const props = withDefaults(
  defineProps<PinInputRootProps<Type> & { class?: HTMLAttributes['class'] }>(),
  {
    otp: true,
  },
);
const emits = defineEmits<PinInputRootEmits<Type>>();
 
const delegatedProps = reactiveOmit(props, 'class');
 
const forwarded = useForwardPropsEmits(delegatedProps, emits);
</script>
 
<template>
  <PinInputRoot
    :otp="props.otp"
    data-slot="pin-input"
    v-bind="forwarded"
    :class="
      cn(
        'flex items-center gap-2 has-disabled:opacity-50 disabled:cursor-not-allowed',
        props.class,
      )
    "
  >
    <slot></slot>
  </PinInputRoot>
</template>