feat(admin-ui): shadcn primitives + @/ui barrel (Stage 2.1)

This commit is contained in:
Александр Зимин
2026-05-10 21:47:24 +00:00
parent c11a70128c
commit 5d12c89c4f
36 changed files with 2826 additions and 28 deletions
@@ -0,0 +1,44 @@
import * as React from 'react'
import { Search, X } from 'lucide-react'
import { cn } from '@/lib/utils'
import { Input } from './input'
/**
* SearchInput — Input с magnifying-glass иконкой слева и optional clear button
* справа когда есть value. Заменяет {@code @nstart/ui} SearchInput.
*/
export type SearchInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> & {
onClear?: () => void
}
export const SearchInput = React.forwardRef<HTMLInputElement, SearchInputProps>(
function SearchInput({ className, value, onClear, ...props }, ref) {
const hasValue = value !== undefined && value !== ''
return (
<div className="relative w-full">
<Search
size={14}
strokeWidth={2}
className="pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-mute"
/>
<Input
ref={ref}
type="search"
value={value}
className={cn('pl-8', hasValue && onClear && 'pr-8', className)}
{...props}
/>
{hasValue && onClear && (
<button
type="button"
aria-label="Очистить"
onClick={onClear}
className="absolute right-2 top-1/2 -translate-y-1/2 text-mute hover:text-ink rounded-sm p-0.5 hover:bg-surface-2"
>
<X size={13} strokeWidth={2} />
</button>
)}
</div>
)
},
)