mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* docs: optimize route higtlight (#4520) * docs: optimize home display (#4519) * docs: optimize home display and route highlight * docs: optimize home display * fix(alert): propagate className (#4535) * fix(alert): propagate className * chore(alert): remove className from alert theme * fix(avatar): title type in Avatar (#4529) * fix(avatar): title type in Avatar * fix(alert): apply isEmpty check on title * fix(alert): alert interface props type * refactor: remove unnecessary props types (#4530) * refactor(docs): remove string type as it is included in ReactNode * refactor: remove unnecessary types * feat(changeset): add changeset * chore: remove changeset * refactor: remove null since ReactNode unions it already * fix(input): use onPress for wrapper click focus (#4483) * fix(input): use onPress for wrapper click focus * test(input): wrapper click focus test * chore(changeset): input onPress for wrapper click focus * chore(changeset): minor wording * Refactor/rebrand (#4532) * chore: rebrand in progress * chore: update docs to use heroui * chore: components renbranded * chore: figma moved to the docs files * fix: posthog config * fix(docs): extra classname in form example (#4465) * chore: clean git * chore: make heroui private * chore: new logo * chore: node env var renamed * chore: public robots txt deleted * chore: wrangler installed * chore: wrangler renamed * chore: cloudlfare workers removed * chore: force vercel deploy * refactor: first migration and provider * refactor: rename nextui plugin * refactor: rename github site * refactor: rename CONTRIBUTING * refactor: rename package name * refactor: nextjs image hostname * refactor: mdx repo nextui-org rename frontio-ai * refactor: nextui.org rename heroui.com * refactor: add heroui to missing places * fix: heroui plugin name * fix: update docs * docs: nextui to heroui add npmrc pnpm migratation * chore: rename all packages with new org name * chore: replace frontio-ai by frontioai * chore: revert previous changes * chore: small adjustment * chore: doc updated * feat: blog * chore: avatar updated * fix: url * chore: add new ogimage * fix: ogimage command * fix: heroui name and storybook welcome page * fix: og image url * feat: favicon and icon changed --------- Co-authored-by: աӄա <wingkwong.code@gmail.com> Co-authored-by: winches <329487092@qq.com> * fix: postbuild script * chore: core package updates * ci(changesets): version packages (#4569) Co-authored-by: Junior Garcia <jrgarciadev@gmail.com> * feat: contributors added to the blog --------- Co-authored-by: winches <329487092@qq.com> Co-authored-by: աӄա <wingkwong.code@gmail.com> Co-authored-by: Peterl561 <76144929+Peterl561@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
304 lines
7.7 KiB
JavaScript
304 lines
7.7 KiB
JavaScript
import {Autocomplete, AutocompleteItem, Avatar, Button} from "@heroui/react";
|
|
|
|
const SearchIcon = ({size = 24, strokeWidth = 1.5, width, height, ...props}) => {
|
|
return (
|
|
<svg
|
|
aria-hidden="true"
|
|
fill="none"
|
|
focusable="false"
|
|
height={height || size}
|
|
role="presentation"
|
|
viewBox="0 0 24 24"
|
|
width={width || size}
|
|
{...props}
|
|
>
|
|
<path
|
|
d="M11.5 21C16.7467 21 21 16.7467 21 11.5C21 6.25329 16.7467 2 11.5 2C6.25329 2 2 6.25329 2 11.5C2 16.7467 6.25329 21 11.5 21Z"
|
|
stroke="currentColor"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={strokeWidth}
|
|
/>
|
|
<path
|
|
d="M22 22L20 20"
|
|
stroke="currentColor"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={strokeWidth}
|
|
/>
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export const users = [
|
|
{
|
|
id: 1,
|
|
name: "Tony Reichert",
|
|
role: "CEO",
|
|
team: "Management",
|
|
status: "active",
|
|
age: "29",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/1.png",
|
|
email: "tony.reichert@example.com",
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "Zoey Lang",
|
|
role: "Tech Lead",
|
|
team: "Development",
|
|
status: "paused",
|
|
age: "25",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/1.png",
|
|
email: "zoey.lang@example.com",
|
|
},
|
|
{
|
|
id: 3,
|
|
name: "Jane Fisher",
|
|
role: "Sr. Dev",
|
|
team: "Development",
|
|
status: "active",
|
|
age: "22",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/2.png",
|
|
email: "jane.fisher@example.com",
|
|
},
|
|
{
|
|
id: 4,
|
|
name: "William Howard",
|
|
role: "C.M.",
|
|
team: "Marketing",
|
|
status: "vacation",
|
|
age: "28",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/2.png",
|
|
email: "william.howard@example.com",
|
|
},
|
|
{
|
|
id: 5,
|
|
name: "Kristen Copper",
|
|
role: "S. Manager",
|
|
team: "Sales",
|
|
status: "active",
|
|
age: "24",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/3.png",
|
|
email: "kristen.cooper@example.com",
|
|
},
|
|
{
|
|
id: 6,
|
|
name: "Brian Kim",
|
|
role: "P. Manager",
|
|
team: "Management",
|
|
age: "29",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/3.png",
|
|
email: "brian.kim@example.com",
|
|
status: "active",
|
|
},
|
|
{
|
|
id: 7,
|
|
name: "Michael Hunt",
|
|
role: "Designer",
|
|
team: "Design",
|
|
status: "paused",
|
|
age: "27",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/4.png",
|
|
email: "michael.hunt@example.com",
|
|
},
|
|
{
|
|
id: 8,
|
|
name: "Samantha Brooks",
|
|
role: "HR Manager",
|
|
team: "HR",
|
|
status: "active",
|
|
age: "31",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/4.png",
|
|
email: "samantha.brooks@example.com",
|
|
},
|
|
{
|
|
id: 9,
|
|
name: "Frank Harrison",
|
|
role: "F. Manager",
|
|
team: "Finance",
|
|
status: "vacation",
|
|
age: "33",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/5.png",
|
|
email: "frank.harrison@example.com",
|
|
},
|
|
{
|
|
id: 10,
|
|
name: "Emma Adams",
|
|
role: "Ops Manager",
|
|
team: "Operations",
|
|
status: "active",
|
|
age: "35",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/5.png",
|
|
email: "emma.adams@example.com",
|
|
},
|
|
{
|
|
id: 11,
|
|
name: "Brandon Stevens",
|
|
role: "Jr. Dev",
|
|
team: "Development",
|
|
status: "active",
|
|
age: "22",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/7.png",
|
|
email: "brandon.stevens@example.com",
|
|
},
|
|
{
|
|
id: 12,
|
|
name: "Megan Richards",
|
|
role: "P. Manager",
|
|
team: "Product",
|
|
status: "paused",
|
|
age: "28",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/7.png",
|
|
email: "megan.richards@example.com",
|
|
},
|
|
{
|
|
id: 13,
|
|
name: "Oliver Scott",
|
|
role: "S. Manager",
|
|
team: "Security",
|
|
status: "active",
|
|
age: "37",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/8.png",
|
|
email: "oliver.scott@example.com",
|
|
},
|
|
{
|
|
id: 14,
|
|
name: "Grace Allen",
|
|
role: "M. Specialist",
|
|
team: "Marketing",
|
|
status: "active",
|
|
age: "30",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/8.png",
|
|
email: "grace.allen@example.com",
|
|
},
|
|
{
|
|
id: 15,
|
|
name: "Noah Carter",
|
|
role: "IT Specialist",
|
|
team: "I. Technology",
|
|
status: "paused",
|
|
age: "31",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/9.png",
|
|
email: "noah.carter@example.com",
|
|
},
|
|
{
|
|
id: 16,
|
|
name: "Ava Perez",
|
|
role: "Manager",
|
|
team: "Sales",
|
|
status: "active",
|
|
age: "29",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/9.png",
|
|
email: "ava.perez@example.com",
|
|
},
|
|
{
|
|
id: 17,
|
|
name: "Liam Johnson",
|
|
role: "Data Analyst",
|
|
team: "Analysis",
|
|
status: "active",
|
|
age: "28",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/11.png",
|
|
email: "liam.johnson@example.com",
|
|
},
|
|
{
|
|
id: 18,
|
|
name: "Sophia Taylor",
|
|
role: "QA Analyst",
|
|
team: "Testing",
|
|
status: "active",
|
|
age: "27",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/11.png",
|
|
email: "sophia.taylor@example.com",
|
|
},
|
|
{
|
|
id: 19,
|
|
name: "Lucas Harris",
|
|
role: "Administrator",
|
|
team: "Information Technology",
|
|
status: "paused",
|
|
age: "32",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/12.png",
|
|
email: "lucas.harris@example.com",
|
|
},
|
|
{
|
|
id: 20,
|
|
name: "Mia Robinson",
|
|
role: "Coordinator",
|
|
team: "Operations",
|
|
status: "active",
|
|
age: "26",
|
|
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/12.png",
|
|
email: "mia.robinson@example.com",
|
|
},
|
|
];
|
|
|
|
export default function App() {
|
|
return (
|
|
<Autocomplete
|
|
aria-label="Select an employee"
|
|
classNames={{
|
|
base: "max-w-xs",
|
|
listboxWrapper: "max-h-[320px]",
|
|
selectorButton: "text-default-500",
|
|
}}
|
|
defaultItems={users}
|
|
inputProps={{
|
|
classNames: {
|
|
input: "ml-1",
|
|
inputWrapper: "h-[48px]",
|
|
},
|
|
}}
|
|
listboxProps={{
|
|
hideSelectedIcon: true,
|
|
itemClasses: {
|
|
base: [
|
|
"rounded-medium",
|
|
"text-default-500",
|
|
"transition-opacity",
|
|
"data-[hover=true]:text-foreground",
|
|
"dark:data-[hover=true]:bg-default-50",
|
|
"data-[pressed=true]:opacity-70",
|
|
"data-[hover=true]:bg-default-200",
|
|
"data-[selectable=true]:focus:bg-default-100",
|
|
"data-[focus-visible=true]:ring-default-500",
|
|
],
|
|
},
|
|
}}
|
|
placeholder="Enter employee name"
|
|
popoverProps={{
|
|
offset: 10,
|
|
classNames: {
|
|
base: "rounded-large",
|
|
content: "p-1 border-small border-default-100 bg-background",
|
|
},
|
|
}}
|
|
radius="full"
|
|
startContent={<SearchIcon className="text-default-400" size={20} strokeWidth={2.5} />}
|
|
variant="bordered"
|
|
>
|
|
{(item) => (
|
|
<AutocompleteItem key={item.id} textValue={item.name}>
|
|
<div className="flex justify-between items-center">
|
|
<div className="flex gap-2 items-center">
|
|
<Avatar alt={item.name} className="flex-shrink-0" size="sm" src={item.avatar} />
|
|
<div className="flex flex-col">
|
|
<span className="text-small">{item.name}</span>
|
|
<span className="text-tiny text-default-400">{item.team}</span>
|
|
</div>
|
|
</div>
|
|
<Button
|
|
className="border-small mr-0.5 font-medium shadow-small"
|
|
radius="full"
|
|
size="sm"
|
|
variant="bordered"
|
|
>
|
|
Add
|
|
</Button>
|
|
</div>
|
|
</AutocompleteItem>
|
|
)}
|
|
</Autocomplete>
|
|
);
|
|
}
|