mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
- Vite 6 → 8 (Rolldown bundler), laravel-vite-plugin 1 → 3, @vitejs/plugin-vue 5 → 6 - Tailwind CSS 3 → 4 with CSS-based config (@theme, @plugin, @utility) - Add @tailwindcss/vite plugin, remove postcss/autoprefixer/sass - Convert SCSS files to plain CSS (resources/sass → resources/css) - Migrate tailwind.config.js to CSS @theme directives - Rename deprecated utility classes (shadow-sm→shadow-xs, outline-none→outline-hidden, rounded-sm→rounded-xs, bg-gradient-to→bg-linear-to, ring→ring-3) - Migrate opacity utilities to color modifiers (bg-opacity, text-opacity, border-opacity, ring-opacity → color/N syntax) - Update primary color CSS vars to full rgb() values for TW4 color-mix() - Fix border-l color specificity for sidebar navigation (TW4 default border color changed from gray-200 to currentColor) - Fix invalid border color classes (border-grey-light, border-modal-bg, border--200) - Add @reference directive for @apply in Vue component style blocks - Convert Vue component <style lang="scss"> blocks to plain CSS
106 lines
2.3 KiB
Vue
106 lines
2.3 KiB
Vue
<template>
|
|
<BaseContentPlaceholders v-if="contentLoading">
|
|
<BaseContentPlaceholdersBox
|
|
:rounded="true"
|
|
class="w-full"
|
|
:style="`height: ${loadingPlaceholderSize}px`"
|
|
/>
|
|
</BaseContentPlaceholders>
|
|
|
|
<textarea
|
|
v-else
|
|
v-bind="$attrs"
|
|
ref="textarea"
|
|
:value="modelValue"
|
|
:class="[defaultInputClass, inputBorderClass]"
|
|
:disabled="disabled"
|
|
@input="onInput"
|
|
/>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed, onMounted, ref } from 'vue'
|
|
|
|
const props = defineProps({
|
|
contentLoading: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
row: {
|
|
type: Number,
|
|
default: null,
|
|
},
|
|
invalid: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
modelValue: {
|
|
type: [String, Number],
|
|
default: '',
|
|
},
|
|
defaultInputClass: {
|
|
type: String,
|
|
default:
|
|
'box-border w-full px-3 py-2 text-sm not-italic font-normal leading-snug text-left text-black placeholder-gray-400 bg-white border border-gray-200 border-solid rounded outline-hidden',
|
|
},
|
|
autosize: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
borderless: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
})
|
|
|
|
const textarea = ref(null)
|
|
|
|
const inputBorderClass = computed(() => {
|
|
if (props.invalid && !props.borderless) {
|
|
return 'border-red-400 ring-red-400 focus:ring-red-400 focus:border-red-400'
|
|
} else if (!props.borderless) {
|
|
return 'focus:ring-primary-400 focus:border-primary-400'
|
|
}
|
|
|
|
return 'border-none outline-hidden focus:ring-primary-400 focus:border focus:border-primary-400'
|
|
})
|
|
|
|
const loadingPlaceholderSize = computed(() => {
|
|
switch (props.row) {
|
|
case 2:
|
|
return '56'
|
|
case 4:
|
|
return '94'
|
|
default:
|
|
return '56'
|
|
}
|
|
})
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
|
|
|
function onInput(e) {
|
|
emit('update:modelValue', e.target.value)
|
|
|
|
if (props.autosize) {
|
|
e.target.style.height = 'auto'
|
|
e.target.style.height = `${e.target.scrollHeight}px`
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
if (textarea.value && props.autosize) {
|
|
textarea.value.style.height = textarea.value.scrollHeight + 'px'
|
|
|
|
if (textarea.value.style.overflow && textarea.value.style.overflow.y) {
|
|
textarea.value.style.overflow.y = 'hidden'
|
|
}
|
|
|
|
textarea.value.style.resize = 'none'
|
|
}
|
|
})
|
|
</script>
|