mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 17:24:10 +00:00
Now that the legacy v1 frontend (commit 064bdf53) is gone, the v2 directory is the only frontend and the v2 suffix is just noise. Renames resources/scripts-v2 to resources/scripts via git mv (so git records the move as renames, preserving blame and log --follow), then bulk-rewrites the 152 files that imported via @v2/... to use @/scripts/... instead. The existing @ alias (resources/) covers the new path with no extra config needed.
Drops the now-unused @v2 alias from vite.config.js and points the laravel-vite-plugin entry at resources/scripts/main.ts. Updates the only blade reference (resources/views/app.blade.php) to match. The package.json test script (eslint ./resources/scripts) automatically targets the right place after the rename without any edit.
Verified: npm run build exits clean and the Vite warning lines now reference resources/scripts/plugins/i18n.ts, confirming every import resolved through the new path. git log --follow on any moved file walks back through its scripts-v2 history.
97 lines
2.4 KiB
Vue
97 lines
2.4 KiB
Vue
<template>
|
|
<div :class="containerClasses" class="relative w-full text-left">
|
|
<ContentPlaceholder v-if="contentLoading">
|
|
<ContentPlaceholderText :lines="1" :class="contentLoadClass" />
|
|
</ContentPlaceholder>
|
|
<label
|
|
v-else-if="label"
|
|
:class="labelClasses"
|
|
class="
|
|
flex
|
|
text-sm
|
|
not-italic
|
|
items-center
|
|
font-medium
|
|
text-heading
|
|
whitespace-nowrap
|
|
justify-between
|
|
"
|
|
>
|
|
<div>
|
|
{{ label }}
|
|
<span v-show="required" class="text-sm text-red-500"> * </span>
|
|
</div>
|
|
<slot v-if="hasRightLabelSlot" name="labelRight" />
|
|
<BaseIcon
|
|
v-if="tooltip"
|
|
v-tooltip="{ content: tooltip }"
|
|
name="InformationCircleIcon"
|
|
class="h-4 text-subtle cursor-pointer hover:text-body"
|
|
/>
|
|
</label>
|
|
<div :class="inputContainerClasses">
|
|
<slot></slot>
|
|
<span v-if="helpText" class="text-muted text-xs mt-1 font-light">
|
|
{{ helpText }}
|
|
</span>
|
|
<span v-if="error" class="block mt-0.5 text-sm text-red-500">
|
|
{{ error }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, useSlots } from 'vue'
|
|
import { ContentPlaceholder, ContentPlaceholderText } from '../layout'
|
|
|
|
interface Props {
|
|
contentLoading?: boolean
|
|
contentLoadClass?: string
|
|
label?: string
|
|
variant?: 'vertical' | 'horizontal'
|
|
error?: string | boolean | null
|
|
required?: boolean
|
|
tooltip?: string | null
|
|
helpText?: string | null
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
contentLoading: false,
|
|
contentLoadClass: 'w-16 h-5',
|
|
label: '',
|
|
variant: 'vertical',
|
|
error: null,
|
|
required: false,
|
|
tooltip: null,
|
|
helpText: null,
|
|
})
|
|
|
|
const containerClasses = computed<string>(() => {
|
|
if (props.variant === 'horizontal') {
|
|
return 'grid md:grid-cols-12 items-center'
|
|
}
|
|
return ''
|
|
})
|
|
|
|
const labelClasses = computed<string>(() => {
|
|
if (props.variant === 'horizontal') {
|
|
return 'relative pr-0 pt-1 mr-3 text-sm md:col-span-4 md:text-right mb-1 md:mb-0'
|
|
}
|
|
return ''
|
|
})
|
|
|
|
const inputContainerClasses = computed<string>(() => {
|
|
if (props.variant === 'horizontal') {
|
|
return 'md:col-span-8 md:col-start-5 md:col-ends-12'
|
|
}
|
|
return 'flex flex-col mt-1'
|
|
})
|
|
|
|
const slots = useSlots()
|
|
|
|
const hasRightLabelSlot = computed<boolean>(() => {
|
|
return !!slots.labelRight
|
|
})
|
|
</script>
|