Skip to content

Commit fc27889

Browse files
authored
Upgrade to shadcn-vue v4 (#232)
* switch to shadcn-vue v4 * change component style to v4 * migrate to InputOTP component
1 parent 6a0769d commit fc27889

File tree

128 files changed

+828
-816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+828
-816
lines changed

components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://shadcn-vue.com/schema.json",
3-
"style": "default",
3+
"style": "new-york-v4",
44
"tailwind": {
55
"config": "tailwind.config.js",
66
"css": "resources/css/app.css",

package-lock.json

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
"clsx": "^2.1.1",
3737
"laravel-vite-plugin": "^2.0.0",
3838
"lucide-vue-next": "^0.468.0",
39-
"reka-ui": "^2.4.1",
39+
"reka-ui": "^2.6.1",
4040
"tailwind-merge": "^3.2.0",
4141
"tailwindcss": "^4.1.1",
4242
"tw-animate-css": "^1.2.5",
43-
"vue": "^3.5.13"
43+
"vue": "^3.5.13",
44+
"vue-input-otp": "^0.3.2"
4445
},
4546
"optionalDependencies": {
4647
"@rollup/rollup-linux-x64-gnu": "4.9.5",

resources/js/components/TwoFactorSetupModal.vue

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import AlertError from '@/components/AlertError.vue';
33
import InputError from '@/components/InputError.vue';
44
import { Button } from '@/components/ui/button';
5-
import { Spinner } from '@/components/ui/spinner';
65
import {
76
Dialog,
87
DialogContent,
@@ -11,10 +10,11 @@ import {
1110
DialogTitle,
1211
} from '@/components/ui/dialog';
1312
import {
14-
PinInput,
15-
PinInputGroup,
16-
PinInputSlot,
17-
} from '@/components/ui/pin-input';
13+
InputOTP,
14+
InputOTPGroup,
15+
InputOTPSlot,
16+
} from '@/components/ui/input-otp';
17+
import { Spinner } from '@/components/ui/spinner';
1818
import { useTwoFactorAuth } from '@/composables/useTwoFactorAuth';
1919
import { confirm } from '@/routes/two-factor';
2020
import { Form } from '@inertiajs/vue3';
@@ -35,8 +35,7 @@ const { qrCodeSvg, manualSetupKey, clearSetupData, fetchSetupData, errors } =
3535
useTwoFactorAuth();
3636
3737
const showVerificationStep = ref(false);
38-
const code = ref<number[]>([]);
39-
const codeValue = computed<string>(() => code.value.join(''));
38+
const code = ref<string>('');
4039
4140
const pinInputContainerRef = useTemplateRef('pinInputContainerRef');
4241
@@ -91,7 +90,7 @@ const resetModalState = () => {
9190
}
9291
9392
showVerificationStep.value = false;
94-
code.value = [];
93+
code.value = '';
9594
};
9695
9796
watch(
@@ -234,35 +233,32 @@ watch(
234233
<Form
235234
v-bind="confirm.form()"
236235
reset-on-error
237-
@finish="code = []"
236+
@finish="code = ''"
238237
@success="isOpen = false"
239238
v-slot="{ errors, processing }"
240239
>
241-
<input type="hidden" name="code" :value="codeValue" />
240+
<input type="hidden" name="code" :value="code" />
242241
<div
243242
ref="pinInputContainerRef"
244243
class="relative w-full space-y-3"
245244
>
246245
<div
247246
class="flex w-full flex-col items-center justify-center space-y-3 py-2"
248247
>
249-
<PinInput
248+
<InputOTP
250249
id="otp"
251-
placeholder=""
252250
v-model="code"
253-
type="number"
254-
otp
251+
:maxlength="6"
252+
:disabled="processing"
255253
>
256-
<PinInputGroup>
257-
<PinInputSlot
258-
autofocus
259-
v-for="(id, index) in 6"
260-
:key="id"
261-
:index="index"
262-
:disabled="processing"
254+
<InputOTPGroup>
255+
<InputOTPSlot
256+
v-for="index in 6"
257+
:key="index"
258+
:index="index - 1"
263259
/>
264-
</PinInputGroup>
265-
</PinInput>
260+
</InputOTPGroup>
261+
</InputOTP>
266262
<InputError
267263
:message="
268264
errors?.confirmTwoFactorAuthentication
@@ -284,9 +280,7 @@ watch(
284280
<Button
285281
type="submit"
286282
class="w-auto flex-1"
287-
:disabled="
288-
processing || codeValue.length < 6
289-
"
283+
:disabled="processing || code.length < 6"
290284
>
291285
Confirm
292286
</Button>

resources/js/components/ui/avatar/Avatar.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script setup lang="ts">
2-
import type { HTMLAttributes } from 'vue'
3-
import { cn } from '@/lib/utils'
4-
import { AvatarRoot } from 'reka-ui'
2+
import type { HTMLAttributes } from "vue"
3+
import { AvatarRoot } from "reka-ui"
4+
import { cn } from "@/lib/utils"
55
66
const props = defineProps<{
7-
class?: HTMLAttributes['class']
7+
class?: HTMLAttributes["class"]
88
}>()
99
</script>
1010

resources/js/components/ui/avatar/AvatarFallback.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<script setup lang="ts">
2-
import { cn } from '@/lib/utils'
3-
import { AvatarFallback, type AvatarFallbackProps } from 'reka-ui'
4-
import { computed, type HTMLAttributes } from 'vue'
2+
import type { AvatarFallbackProps } from "reka-ui"
3+
import type { HTMLAttributes } from "vue"
4+
import { reactiveOmit } from "@vueuse/core"
5+
import { AvatarFallback } from "reka-ui"
6+
import { cn } from "@/lib/utils"
57
6-
const props = defineProps<AvatarFallbackProps & { class?: HTMLAttributes['class'] }>()
8+
const props = defineProps<AvatarFallbackProps & { class?: HTMLAttributes["class"] }>()
79
8-
const delegatedProps = computed(() => {
9-
const { class: _, ...delegated } = props
10-
11-
return delegated
12-
})
10+
const delegatedProps = reactiveOmit(props, "class")
1311
</script>
1412

1513
<template>

resources/js/components/ui/avatar/AvatarImage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
2-
import type { AvatarImageProps } from 'reka-ui'
3-
import { AvatarImage } from 'reka-ui'
2+
import type { AvatarImageProps } from "reka-ui"
3+
import { AvatarImage } from "reka-ui"
44
55
const props = defineProps<AvatarImageProps>()
66
</script>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { default as Avatar } from './Avatar.vue'
2-
export { default as AvatarFallback } from './AvatarFallback.vue'
3-
export { default as AvatarImage } from './AvatarImage.vue'
1+
export { default as Avatar } from "./Avatar.vue"
2+
export { default as AvatarFallback } from "./AvatarFallback.vue"
3+
export { default as AvatarImage } from "./AvatarImage.vue"

resources/js/components/ui/badge/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority"
44
export { default as Badge } from "./Badge.vue"
55

66
export const badgeVariants = cva(
7-
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
7+
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
88
{
99
variants: {
1010
variant: {

resources/js/components/ui/breadcrumb/Breadcrumb.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
2-
import type { HTMLAttributes } from 'vue'
2+
import type { HTMLAttributes } from "vue"
33
44
const props = defineProps<{
5-
class?: HTMLAttributes['class']
5+
class?: HTMLAttributes["class"]
66
}>()
77
</script>
88

0 commit comments

Comments
 (0)