diff --git a/web/src/lib/components/ui/Textarea.stories.svelte b/web/src/lib/components/ui/Textarea.stories.svelte index 23441593..f0c6feba 100644 --- a/web/src/lib/components/ui/Textarea.stories.svelte +++ b/web/src/lib/components/ui/Textarea.stories.svelte @@ -1,5 +1,7 @@ - + + +
diff --git a/web/src/lib/components/ui/Textarea.svelte b/web/src/lib/components/ui/Textarea.svelte index b91f3c5a..da0511e4 100644 --- a/web/src/lib/components/ui/Textarea.svelte +++ b/web/src/lib/components/ui/Textarea.svelte @@ -2,20 +2,36 @@ import { tv, type VariantProps } from "tailwind-variants"; export const textareaField = tv({ - base: "min-h-20 w-full resize-y rounded border bg-background-default px-3 py-2 text-sm transition-colors placeholder:text-foreground-placeholder focus:outline-none", + slots: { + root: "relative flex max-h-64 items-start gap-1 rounded border bg-background-default px-2.5 py-2 transition-colors", + textarea: + "min-h-24 flex-1 bg-transparent text-sm leading-6 outline-none placeholder:text-foreground-placeholder read-only:resize-none disabled:cursor-not-allowed disabled:resize-none" + }, variants: { error: { - false: - "border-border-default focus:border-border-strong focus:ring-1 focus:ring-border-strong", - true: "border-border-danger bg-background-danger-subtle text-foreground-danger focus:border-border-focus-danger focus:ring-1 focus:ring-border-focus-danger" + false: { + root: "border-border-default focus-within:border-border-strong focus-within:ring-1 focus-within:ring-border-strong" + }, + true: { + root: "border-border-danger bg-background-danger-subtle text-foreground-danger focus-within:border-border-focus-danger focus-within:ring-1 focus-within:ring-border-focus-danger", + textarea: "placeholder:text-foreground-danger" + } }, disabled: { false: "", - true: "cursor-not-allowed resize-none bg-background-inset text-foreground-disabled" + true: { + root: "cursor-not-allowed border-border-disabled bg-background-subtle text-foreground-muted" + } }, readonly: { false: "", - true: "cursor-default resize-none bg-background-subtle" + true: { + root: "cursor-default border-border-disabled bg-background-subtle text-foreground-muted" + } + }, + resizeable: { + false: { textarea: "resize-none" }, + true: { textarea: "resize-y" } } }, defaultVariants: { @@ -29,7 +45,8 @@ -
+
+ {#if iconLeft} + {@const IconLeft = iconLeft} +