-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7af3b61
commit 454ecf0
Showing
24 changed files
with
392 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/www/src/lib/registry/default/example/PinInputControlled.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { | ||
PinInput, | ||
PinInputGroup, | ||
PinInputInput, | ||
} from '@/lib/registry/default/ui/pin-input' | ||
const value = ref<string[]>(['1', '2', '3']) | ||
const handleComplete = (e: string[]) => alert(e.join('')) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<PinInput | ||
id="pin-input" | ||
v-model="value" | ||
placeholder="○" | ||
@complete="handleComplete" | ||
> | ||
<PinInputGroup> | ||
<PinInputInput | ||
v-for="(id, index) in 5" | ||
:key="id" | ||
:index="index" | ||
/> | ||
</PinInputGroup> | ||
</PinInput> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
apps/www/src/lib/registry/default/example/PinInputDisabled.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { | ||
PinInput, | ||
PinInputGroup, | ||
PinInputInput, | ||
} from '@/lib/registry/default/ui/pin-input' | ||
const value = ref<string[]>([]) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<PinInput | ||
id="pin-input" | ||
v-model="value" | ||
placeholder="○" | ||
disabled | ||
> | ||
<PinInputGroup> | ||
<PinInputInput | ||
v-for="(id, index) in 5" | ||
:key="id" | ||
:index="index" | ||
/> | ||
</PinInputGroup> | ||
</PinInput> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apps/www/src/lib/registry/default/example/PinInputSeparatorDemo.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { | ||
PinInput, | ||
PinInputGroup, | ||
PinInputInput, | ||
PinInputSeparator, | ||
} from '@/lib/registry/default/ui/pin-input' | ||
const value = ref<string[]>([]) | ||
const handleComplete = (e: string[]) => alert(e.join('')) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<PinInput | ||
id="pin-input" | ||
v-model="value" | ||
placeholder="○" | ||
@complete="handleComplete" | ||
> | ||
<PinInputGroup class="gap-1"> | ||
<template v-for="(id, index) in 5" :key="id"> | ||
<PinInputInput | ||
class="rounded-md border" | ||
:index="index" | ||
/> | ||
<template v-if="index !== 4"> | ||
<PinInputSeparator /> | ||
</template> | ||
</template> | ||
</PinInputGroup> | ||
</PinInput> | ||
</div> | ||
</template> |
18 changes: 18 additions & 0 deletions
18
apps/www/src/lib/registry/default/ui/pin-input/PinInputGroup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script setup lang="ts"> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { Primitive, type PrimitiveProps, useForwardProps } from 'radix-vue' | ||
import { cn } from '@/lib/utils' | ||
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<Primitive v-bind="forwardedProps" :class="cn('flex items-center', props.class)"> | ||
<slot /> | ||
</primitive> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/www/src/lib/registry/default/ui/pin-input/PinInputSeparator.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script setup lang="ts"> | ||
import { Primitive, type PrimitiveProps, useForwardProps } from 'radix-vue' | ||
import { Dot } from 'lucide-vue-next' | ||
const props = defineProps<PrimitiveProps>() | ||
const forwardedProps = useForwardProps(props) | ||
</script> | ||
|
||
<template> | ||
<Primitive v-bind="forwardedProps"> | ||
<slot> | ||
<Dot /> | ||
</slot> | ||
</primitive> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { default as PinInput } from './PinInput.vue' | ||
export { default as PinInputGroup } from './PinInputGroup.vue' | ||
export { default as PinInputSeparator } from './PinInputSeparator.vue' | ||
export { default as PinInputInput } from './PinInputInput.vue' |
30 changes: 30 additions & 0 deletions
30
apps/www/src/lib/registry/new-york/example/PinInputControlled.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { | ||
PinInput, | ||
PinInputGroup, | ||
PinInputInput, | ||
} from '@/lib/registry/new-york/ui/pin-input' | ||
const value = ref<string[]>(['1', '2', '3']) | ||
const handleComplete = (e: string[]) => alert(e.join('')) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<PinInput | ||
id="pin-input" | ||
v-model="value" | ||
placeholder="○" | ||
@complete="handleComplete" | ||
> | ||
<PinInputGroup> | ||
<PinInputInput | ||
v-for="(id, index) in 5" | ||
:key="id" | ||
:index="index" | ||
/> | ||
</PinInputGroup> | ||
</PinInput> | ||
</div> | ||
</template> |
Oops, something went wrong.