mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 17:23:21 +03:00
chore: svelte 5 Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
55 lines
1.3 KiB
Svelte
55 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { quintOut } from 'svelte/easing';
|
|
import { fly } from 'svelte/transition';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
export let value: string;
|
|
export let label = '';
|
|
export let desc = '';
|
|
export let required = false;
|
|
export let disabled = false;
|
|
export let isEdited = false;
|
|
|
|
const handleInput = (e: Event) => {
|
|
value = (e.target as HTMLInputElement).value;
|
|
};
|
|
</script>
|
|
|
|
<div class="mb-4 w-full">
|
|
<div class={`flex h-[26px] place-items-center gap-1`}>
|
|
<label class="font-medium text-immich-primary dark:text-immich-dark-primary text-sm" for={label}>{label}</label>
|
|
{#if required}
|
|
<div class="text-red-400">*</div>
|
|
{/if}
|
|
|
|
{#if isEdited}
|
|
<div
|
|
transition:fly={{ x: 10, duration: 200, easing: quintOut }}
|
|
class="rounded-full bg-orange-100 px-2 text-[10px] text-orange-900"
|
|
>
|
|
{$t('unsaved_change')}
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
{#if desc}
|
|
<p class="immich-form-label pb-2 text-sm" id="{label}-desc">
|
|
{desc}
|
|
</p>
|
|
{:else}
|
|
<slot name="desc" />
|
|
{/if}
|
|
|
|
<textarea
|
|
class="immich-form-input w-full pb-2"
|
|
aria-describedby={desc ? `${label}-desc` : undefined}
|
|
aria-labelledby="{label}-label"
|
|
id={label}
|
|
name={label}
|
|
{required}
|
|
{value}
|
|
on:input={handleInput}
|
|
{disabled}
|
|
></textarea>
|
|
</div>
|