mirror of
https://github.com/huntabyte/shadcn-svelte.git
synced 2026-09-14 19:33:46 +08:00
17 lines
2.4 KiB
JSON
17 lines
2.4 KiB
JSON
{
|
|
"$schema": "https://shadcn-svelte.com/schema/registry-item.json",
|
|
"name": "input",
|
|
"type": "registry:ui",
|
|
"files": [
|
|
{
|
|
"content": "import Root from \"./input.svelte\";\n\nexport {\n\tRoot,\n\t//\n\tRoot as Input,\n};\n",
|
|
"type": "registry:file",
|
|
"target": "input/index.ts"
|
|
},
|
|
{
|
|
"content": "<script lang=\"ts\">\n\timport type { HTMLInputAttributes, HTMLInputTypeAttribute } from \"svelte/elements\";\n\timport { cn, type WithElementRef } from \"$UTILS$.js\";\n\n\ttype InputType = Exclude<HTMLInputTypeAttribute, \"file\">;\n\n\ttype Props = WithElementRef<\n\t\tOmit<HTMLInputAttributes, \"type\"> &\n\t\t\t({ type: \"file\"; files?: FileList } | { type?: InputType; files?: undefined })\n\t>;\n\n\tlet {\n\t\tref = $bindable(null),\n\t\tvalue = $bindable(),\n\t\ttype,\n\t\tfiles = $bindable(),\n\t\tclass: className,\n\t\t\"data-slot\": dataSlot = \"input\",\n\t\t...restProps\n\t}: Props = $props();\n</script>\n\n{#if type === \"file\"}\n\t<input\n\t\tbind:this={ref}\n\t\tdata-slot={dataSlot}\n\t\tclass={cn(\n\t\t\t\"selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\t\"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]\",\n\t\t\t\"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n\t\t\tclassName\n\t\t)}\n\t\ttype=\"file\"\n\t\tbind:files\n\t\tbind:value\n\t\t{...restProps}\n\t/>\n{:else}\n\t<input\n\t\tbind:this={ref}\n\t\tdata-slot={dataSlot}\n\t\tclass={cn(\n\t\t\t\"border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n\t\t\t\"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]\",\n\t\t\t\"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n\t\t\tclassName\n\t\t)}\n\t\t{type}\n\t\tbind:value\n\t\t{...restProps}\n\t/>\n{/if}\n",
|
|
"type": "registry:file",
|
|
"target": "input/input.svelte"
|
|
}
|
|
]
|
|
} |