2022-12-09 15:51:42 -05:00
|
|
|
<script lang="ts" context="module">
|
|
|
|
export enum SettingInputFieldType {
|
2022-12-27 11:36:31 -05:00
|
|
|
EMAIL = 'email',
|
2022-12-09 15:51:42 -05:00
|
|
|
TEXT = 'text',
|
|
|
|
NUMBER = 'number',
|
|
|
|
PASSWORD = 'password'
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { quintOut } from 'svelte/easing';
|
|
|
|
import { fly } from 'svelte/transition';
|
|
|
|
|
|
|
|
export let inputType: SettingInputFieldType;
|
|
|
|
export let value: string;
|
2022-12-16 14:26:12 -06:00
|
|
|
export let label = '';
|
2022-12-09 15:51:42 -05:00
|
|
|
export let required = false;
|
|
|
|
export let disabled = false;
|
2022-12-16 14:26:12 -06:00
|
|
|
export let isEdited = false;
|
2022-12-09 15:51:42 -05:00
|
|
|
|
|
|
|
const handleInput = (e: Event) => {
|
|
|
|
value = (e.target as HTMLInputElement).value;
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
2022-12-16 14:26:12 -06:00
|
|
|
<div class="w-full">
|
|
|
|
<div class={`flex place-items-center gap-1 h-[26px]`}>
|
2023-01-09 14:16:08 -06:00
|
|
|
<label class={`immich-form-label text-sm`} for={label}>{label}</label>
|
2022-12-09 15:51:42 -05:00
|
|
|
{#if required}
|
|
|
|
<div class="text-red-400">*</div>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{#if isEdited}
|
|
|
|
<div
|
|
|
|
transition:fly={{ x: 10, duration: 200, easing: quintOut }}
|
2022-12-16 14:26:12 -06:00
|
|
|
class="bg-orange-100 px-2 rounded-full text-orange-900 text-[10px]"
|
2022-12-09 15:51:42 -05:00
|
|
|
>
|
|
|
|
Unsaved change
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
<input
|
2022-12-16 14:26:12 -06:00
|
|
|
class="immich-form-input w-full"
|
2022-12-09 15:51:42 -05:00
|
|
|
id={label}
|
|
|
|
name={label}
|
|
|
|
type={inputType}
|
|
|
|
{required}
|
|
|
|
{value}
|
|
|
|
on:input={handleInput}
|
|
|
|
{disabled}
|
|
|
|
/>
|
|
|
|
</div>
|