kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1"use client";
2
3import { Input as InputPrimitive } from "@base-ui/react/input";
4import type * as React from "react";
5
6import { cn } from "@/lib/cn";
7
8type InputProps = Omit<
9 InputPrimitive.Props & React.RefAttributes<HTMLInputElement>,
10 "size"
11> & {
12 size?: "sm" | "default" | "lg" | number;
13 unstyled?: boolean;
14 nativeInput?: boolean;
15};
16
17function Input({
18 className,
19 size = "default",
20 unstyled = false,
21 nativeInput = false,
22 ...props
23}: InputProps) {
24 const inputClassName = cn(
25 "h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5 [transition:background-color_5000000s_ease-in-out_0s]",
26 size === "sm" &&
27 "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5",
28 size === "lg" && "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5",
29 props.type === "search" &&
30 "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
31 props.type === "file" &&
32 "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
33 );
34
35 return (
36 <span
37 className={
38 cn(
39 !unstyled &&
40 "relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
41 className,
42 ) || undefined
43 }
44 data-size={size}
45 data-slot="input-control"
46 >
47 {nativeInput ? (
48 <input
49 className={inputClassName}
50 data-slot="input"
51 size={typeof size === "number" ? size : undefined}
52 {...props}
53 />
54 ) : (
55 <InputPrimitive
56 className={inputClassName}
57 data-slot="input"
58 size={typeof size === "number" ? size : undefined}
59 {...props}
60 />
61 )}
62 </span>
63 );
64}
65
66export { Input, type InputProps };