A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
feat: install form text area
aminnausina0a7078c7379
diff --git a/resources/js/components/cedar-ui/textarea/FormTextArea.vue b/resources/js/components/cedar-ui/textarea/FormTextArea.vuenew file mode 100644index 00000000..a4cb7bdc--- /dev/null+++ b/resources/js/components/cedar-ui/textarea/FormTextArea.vue@@ -0,0 +1,46 @@+<script setup lang="ts">+import type { FormTextAreaProps } from '@aminnausin/cedar-ui';++import { onMounted, useTemplateRef } from 'vue';+import { InputShell } from '../input';+import { cn } from '@aminnausin/cedar-ui';++const props = withDefaults(defineProps<FormTextAreaProps>(), { maxHeight: 240 });+const model = defineModel<any>();+const textArea = useTemplateRef('textArea');++const resize = () => {+ if (!textArea.value) return;+ textArea.value.style.height = Math.min(props.maxHeight, textArea.value.scrollHeight) + 'px';+};++onMounted(() => {+ resize();+});+</script>++<template>+ <div class="group mt-1 block w-full">+ <InputShell :clamp-text="false">+ <template #input="{ class: inputClass }">+ <textarea+ @input="resize()"+ v-model="model"+ ref="textArea"+ type="text"+ :id="field.name"+ :name="field.name"+ :title="field.text ?? field.name"+ :disabled="field.disabled"+ :required="field.required"+ :placeholder="field.placeholder"+ :class="cn('scrollbar-minimal scrollbar-thumb:bg-foreground-1 min-h-8', inputClass)"+ :style="{+ 'max-height': `${maxHeight}px`,+ 'text-overflow': 'unset',+ }"+ />+ </template>+ </InputShell>+ </div>+</template>diff --git a/resources/js/components/cedar-ui/textarea/index.ts b/resources/js/components/cedar-ui/textarea/index.tsnew file mode 100644index 00000000..3aa08035--- /dev/null+++ b/resources/js/components/cedar-ui/textarea/index.ts@@ -0,0 +1 @@+export { default as FormTextArea } from './FormTextArea.vue';diff --git a/resources/js/components/inputs/FormTextArea.vue b/resources/js/components/inputs/FormTextArea.vuedeleted file mode 100755index 492a4a89..00000000--- a/resources/js/components/inputs/FormTextArea.vue+++ /dev/null@@ -1,42 +0,0 @@-<script setup lang="ts">-import type { FormField } from '@/types/types';--import { onMounted, useTemplateRef } from 'vue';--const props = withDefaults(defineProps<{ field: FormField; maxHeight?: number }>(), { maxHeight: 240 });-const model = defineModel<any>();-const textArea = useTemplateRef('textArea');--const resize = () => {- if (!textArea.value) return;- textArea.value.style.height = '0px';- textArea.value.style.height = Math.min(props.maxHeight, textArea.value.scrollHeight) + 'px';-};--onMounted(() => {- resize();-});-</script>--<template>- <div class="block mt-1 w-full">- <textarea- @input="resize()"- type="text"- ref="textArea"- :class="`flex w-full h-auto min-h-[40px] px-3 py-2 text-sm rounded-md focus:outline-hidden border-none- disabled:cursor-not-allowed disabled:opacity-50- text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-700 placeholder:text-neutral-400- ring-inset focus:ring-inset ring-1 ring-neutral-200 dark:ring-neutral-700- focus:ring-2 focus:ring-indigo-400 dark:focus:ring-indigo-500- scrollbar-minimal scrollbar-track:bg-neutral-300 scrollbar-track:dark:bg-neutral-800`"- :style="`max-height: ${maxHeight}px;`"- :name="field.name"- :title="field.text ?? field.name"- :required="field.required"- :placeholder="field.placeholder ?? 'Type your message here. I will resize based on the height content.'"- v-model="model"- >- </textarea>- </div>-</template>