"use client" import { ReactNode } from "react" import { SearchIcon } from "lucide-react" import { cn } from "@/lib/utils" import { InputGroup, InputGroupAddon, InputGroupInput, } from "@/components/ui/input-group" import { Filters, type Filter, type FilterFieldConfig, } from "@/components/reui/filters" import { SegmentedControl } from "@/components/form-kit" import { DATA_PAGE_TOOLBAR_CLASS } from "@/components/data-grids/shared/data-grid-layout" function DataPageToolbarFrame({ children, className, }: { children: ReactNode className?: string }) { return (
{children}
) } interface DataPageToolbarProps { search?: string onSearchChange?: (value: string) => void searchPlaceholder?: string segmented?: { value: T onChange: (value: T) => void options: { value: T; label: string; count?: number }[] } filters?: Filter[] onFiltersChange?: (filters: Filter[]) => void filterFields?: FilterFieldConfig[] countLabel?: string actions?: ReactNode className?: string } function DataPageToolbar({ search, onSearchChange, searchPlaceholder = "Поиск…", segmented, filters, onFiltersChange, filterFields, countLabel, actions, className, }: DataPageToolbarProps) { return ( {segmented && ( )} {filterFields && filters && onFiltersChange && ( )} {onSearchChange != null && ( onSearchChange(e.target.value)} /> )} {countLabel && ( {countLabel} )} {actions} ) } export { DataPageToolbar, DataPageToolbarFrame, type DataPageToolbarProps }