Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import type { Component } from "svelte";import type { SvelteHTMLElements } from "svelte/elements";import { tv, type VariantProps } from "tailwind-variants";import type { TagVariants } from "$lib/components/ui/Tag.svelte";
export interface InputTag { value: string; label?: string; field?: string; color?: TagVariants["color"]; icon?: Component<SvelteHTMLElements["svg"]>;}
export type TagRejection = "duplicate" | "limit" | "invalid";
export type TagCommitKey = "enter" | "space" | "comma";
/** the character each key stands for. Typing one commits, and a pasted one splits — which is why * `enter` maps to a newline: you can't type one into a single-line input, but you can paste one. */export const TAG_COMMIT_CHARS: Record<TagCommitKey, string> = { enter: "\n", space: " ", comma: ","};
export const inputField = tv({ base: "flex items-center rounded-sm border bg-background-default transition-colors", variants: { size: { small: "min-h-8 gap-1.5 px-1.5 py-1 typography-paragraph-small", regular: "min-h-9 gap-2 px-2 py-1 typography-paragraph-regular", large: "min-h-10 gap-2.5 px-3 py-1 typography-paragraph-large" }, error: { false: "border-border-default focus-within:border-border-strong focus-within:ring-1 focus-within:ring-border-strong", true: "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" }, disabled: { false: "", true: "cursor-not-allowed bg-background-inset text-foreground-disabled" }, rich: { true: "items-center", false: "" } }, defaultVariants: { size: "regular", error: false, disabled: false, rich: false }});
export type InputFieldVariants = VariantProps<typeof inputField>;