<script lang="ts">
	import type { HTMLInputAttributes } from "svelte/elements";
	import type { WithElementRef } from "bits-ui";
	import { cn } from "$lib/utils.js";
	import { TRANSITION_COLORS } from "$lib/core/constants";

	const inputSizes = {
		sm: "px-3 py-2 text-sm file:text-sm",
		default: "px-4 py-3",
		lg: "px-5 py-3 text-lg file:text-lg",
		xl: "px-6 py-4 text-xl file:text-xl",
	};

	let {
		ref = $bindable(null),
		value = $bindable(),
		class: className,
		inputSize = "default",
		...restProps
	}: WithElementRef<HTMLInputAttributes> & {
		inputSize?: keyof typeof inputSizes;
	} = $props();
</script>

<input
	bind:this={ref}
	class={cn(
		"flex w-full items-center rounded-lg border border-input bg-white px-3 py-2 text-sm shadow-sm transition-all file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-50",
		inputSizes[inputSize],
		className,
	)}
	bind:value
	{...restProps}
/>
