Files
gpx.studio/website/src/lib/components/ui/time-picker/TimeComponentInput.svelte
T

63 lines
1.5 KiB
Svelte
Raw Normal View History

2024-06-13 17:36:43 +02:00
<script lang="ts">
2025-06-21 21:07:36 +02:00
import { Input } from '$lib/components/ui/input';
2024-06-13 17:36:43 +02:00
2025-10-24 20:07:15 +02:00
let {
id,
value = $bindable(),
disabled,
oninput = () => {},
onchange = () => {},
onkeypress = () => {},
onfocusin = () => {},
class: className,
}: {
id: string;
value: string | number;
disabled?: boolean;
oninput?: (e: Event) => void;
onchange?: (e: Event) => void;
onkeypress?: (e: KeyboardEvent) => void;
onfocusin?: (e: FocusEvent) => void;
class?: string;
} = $props();
2024-06-13 17:36:43 +02:00
</script>
<div>
2025-06-21 21:07:36 +02:00
<Input
2025-10-24 20:07:15 +02:00
{id}
2025-06-21 21:07:36 +02:00
type="text"
step={1}
bind:value
2025-10-24 20:07:15 +02:00
{disabled}
{oninput}
{onchange}
{onkeypress}
onfocusin={(e) => {
2025-06-21 21:07:36 +02:00
let input = document.activeElement;
if (input instanceof HTMLInputElement) {
input.select();
}
2025-10-24 20:07:15 +02:00
onfocusin(e);
2025-06-21 21:07:36 +02:00
}}
2025-10-24 20:07:15 +02:00
class="w-[22px] {className ?? ''}"
2025-06-21 21:07:36 +02:00
/>
2024-06-13 17:36:43 +02:00
</div>
<style lang="postcss">
2025-06-21 21:07:36 +02:00
@reference "tailwindcss";
div :global(input) {
@apply px-0.5;
2025-10-24 20:07:15 +02:00
@apply py-0;
@apply bg-transparent;
2025-06-21 21:07:36 +02:00
@apply text-right;
@apply border-none;
2025-10-24 20:07:15 +02:00
@apply shadow-none;
2025-06-21 21:07:36 +02:00
@apply focus:ring-0;
@apply focus:ring-offset-0;
@apply focus:outline-none;
@apply focus-visible:ring-0;
@apply focus-visible:ring-offset-0;
@apply focus-visible:outline-none;
}
2024-06-13 17:36:43 +02:00
</style>