(props: {
readonly value: string;
readonly onChange: (value: string) => void;
readonly onClear: () => void;
})
| 563 | }; |
| 564 | |
| 565 | function UserSearch(props: { |
| 566 | readonly value: string; |
| 567 | readonly onChange: (value: string) => void; |
| 568 | readonly onClear: () => void; |
| 569 | }) { |
| 570 | return ( |
| 571 | <div className="relative mb-4 min-w-0" data-slot="admin-users-search"> |
| 572 | <SearchIcon |
| 573 | className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" |
| 574 | aria-hidden |
| 575 | /> |
| 576 | <Input |
| 577 | type="search" |
| 578 | value={props.value} |
| 579 | onChange={(event) => props.onChange((event.target as HTMLInputElement).value)} |
| 580 | onKeyDown={(event) => { |
| 581 | if (event.key === "Escape" && props.value !== "") props.onClear(); |
| 582 | }} |
| 583 | placeholder="Search by name or email" |
| 584 | aria-label="Search users by name or email" |
| 585 | className="h-9 pl-9 pr-9 text-sm [&::-webkit-search-cancel-button]:hidden" |
| 586 | /> |
| 587 | {props.value !== "" && ( |
| 588 | <Button |
| 589 | type="button" |
| 590 | variant="ghost" |
| 591 | size="icon-xs" |
| 592 | aria-label="Clear search" |
| 593 | onClick={props.onClear} |
| 594 | className="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground" |
| 595 | > |
| 596 | <XIcon /> |
| 597 | </Button> |
| 598 | )} |
| 599 | </div> |
| 600 | ); |
| 601 | } |
| 602 | |
| 603 | // ── Page ──────────────────────────────────────────────────────────────────── |
| 604 |
nothing calls this directly
no outgoing calls
no test coverage detected