mirror of
https://github.com/immich-app/immich.git
synced 2025-06-21 06:23:29 -04:00
* feat(web,a11y): slider accessibility improvements * add perceivable focus outline * label all sliders for screen readers * chore: add IDs to all settings sliders * chore: add comment to id prop * fix: switch to using CSS to add outlines * fix: reactive sliderId * fix: bring back the slot * fix: add aria-describedby for the subtitle * fix: cleanup css because disabled slider cannot be focused * fix: add border to the slider when focus is visible --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
55 lines
1.9 KiB
Svelte
55 lines
1.9 KiB
Svelte
<script lang="ts">
|
|
import type { SystemConfigDto } from '@immich/sdk';
|
|
import { isEqual } from 'lodash-es';
|
|
import { createEventDispatcher } from 'svelte';
|
|
import { fade } from 'svelte/transition';
|
|
import type { SettingsEventType } from '../admin-settings';
|
|
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
|
import SettingInputField, {
|
|
SettingInputFieldType,
|
|
} from '$lib/components/shared-components/settings/setting-input-field.svelte';
|
|
import SettingButtonsRow from '$lib/components/shared-components/settings/setting-buttons-row.svelte';
|
|
|
|
export let savedConfig: SystemConfigDto;
|
|
export let defaultConfig: SystemConfigDto;
|
|
export let config: SystemConfigDto; // this is the config that is being edited
|
|
export let disabled = false;
|
|
|
|
const dispatch = createEventDispatcher<SettingsEventType>();
|
|
</script>
|
|
|
|
<div>
|
|
<div in:fade={{ duration: 500 }}>
|
|
<form autocomplete="off" on:submit|preventDefault>
|
|
<div class="ml-4 mt-4 flex flex-col gap-4">
|
|
<SettingSwitch
|
|
id="enable-trash-features"
|
|
title="ENABLED"
|
|
{disabled}
|
|
subtitle="Enable Trash features"
|
|
bind:checked={config.trash.enabled}
|
|
/>
|
|
|
|
<hr />
|
|
|
|
<SettingInputField
|
|
inputType={SettingInputFieldType.NUMBER}
|
|
label="Number of days"
|
|
desc="Number of days to keep the assets in trash before permanently removing them"
|
|
bind:value={config.trash.days}
|
|
required={true}
|
|
disabled={disabled || !config.trash.enabled}
|
|
isEdited={config.trash.days !== savedConfig.trash.days}
|
|
/>
|
|
|
|
<SettingButtonsRow
|
|
on:reset={({ detail }) => dispatch('reset', { ...detail, configKeys: ['trash'] })}
|
|
on:save={() => dispatch('save', { trash: config.trash })}
|
|
showResetToDefault={!isEqual(savedConfig, defaultConfig)}
|
|
{disabled}
|
|
/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|