Skip to content

Commit

Permalink
chore(docs): replace the props of autocomplete from value to key
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-manba committed Nov 21, 2024
1 parent e056c0b commit 7ffedaa
Show file tree
Hide file tree
Showing 25 changed files with 360 additions and 366 deletions.
28 changes: 14 additions & 14 deletions apps/docs/content/components/autocomplete/colors.raw.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -43,7 +43,7 @@ export default function App() {
label="Favorite Animal"
placeholder="Search an animal"
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
))}
</div>
Expand Down
28 changes: 14 additions & 14 deletions apps/docs/content/components/autocomplete/controlled.raw.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -43,7 +43,7 @@ export default function App() {
label="Favorite Animal"
placeholder="Search an animal"
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
))}
</div>
Expand Down
34 changes: 17 additions & 17 deletions apps/docs/content/components/autocomplete/controlled.raw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ import React from "react";
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
const [value, setValue] = React.useState<React.Key | null>("cat");
const [key, setValue] = React.useState<React.Key | null>("cat");

return (
<div className="flex w-full max-w-xs flex-col gap-2">
Expand All @@ -39,13 +39,13 @@ export default function App() {
defaultItems={animals}
label="Favorite Animal"
placeholder="Search an animal"
selectedKey={value}
selectedKey={key}
variant="bordered"
onSelectionChange={setValue}
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
<p className="text-default-500 text-small">Selected: {value}</p>
<p className="text-default-500 text-small">Selected: {key}</p>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -40,7 +40,7 @@ export default function App() {
}}
placeholder="Search an animal"
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
</div>
);
Expand Down
28 changes: 14 additions & 14 deletions apps/docs/content/components/autocomplete/custom-filtering.raw.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -51,7 +51,7 @@ export default function App() {
label="Search an animal"
variant="bordered"
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
);
}
28 changes: 14 additions & 14 deletions apps/docs/content/components/autocomplete/custom-filtering.raw.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -51,7 +51,7 @@ export default function App() {
label="Search an animal"
variant="bordered"
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@ const SelectorIcon = (props) => (
);

export const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{label: "Cat", key: "cat", description: "The second most popular pet in the world"},
{label: "Dog", key: "dog", description: "The most popular pet in the world"},
{label: "Elephant", key: "elephant", description: "The largest land animal"},
{label: "Lion", key: "lion", description: "The king of the jungle"},
{label: "Tiger", key: "tiger", description: "The largest cat species"},
{label: "Giraffe", key: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
key: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{label: "Penguin", key: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", key: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
key: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
key: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
{label: "Otter", key: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", key: "crocodile", description: "A large semiaquatic reptile"},
];

export default function App() {
Expand All @@ -60,7 +60,7 @@ export default function App() {
placeholder="Search an animal"
selectorIcon={<SelectorIcon />}
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
{(item) => <AutocompleteItem key={item.key}>{item.label}</AutocompleteItem>}
</Autocomplete>
);
}
Loading

0 comments on commit 7ffedaa

Please sign in to comment.