diff --git a/src/components/core/Combobox/Combobox.stories.tsx b/src/components/core/Combobox/Combobox.stories.tsx index 87c688c0..d79fb71a 100644 --- a/src/components/core/Combobox/Combobox.stories.tsx +++ b/src/components/core/Combobox/Combobox.stories.tsx @@ -1,5 +1,3 @@ -import { useState } from "react"; - import { comboboxState } from "./Combobox.spec"; import { Combobox, Image } from "components/core"; @@ -64,31 +62,6 @@ export const Default: Story = { }, }; -export const ControlledItems: Story = { - args: { - size: "md", - label: { - singular: "Fruit", - plural: "Fruit", - display: true, - }, - groups: [groups[0]], - }, - render: (args) => { - const allItems = args.groups.flatMap((group) => group.items); - // eslint-disable-next-line react-hooks/rules-of-hooks - const [controlledItems, setControlledItems] = useState(allItems); - - return ( - - ); - }, -}; - export const ImageIcons: Story = { args: { ...Default.args, diff --git a/src/components/core/Combobox/Combobox.tsx b/src/components/core/Combobox/Combobox.tsx index 5504de7b..35a9c927 100644 --- a/src/components/core/Combobox/Combobox.tsx +++ b/src/components/core/Combobox/Combobox.tsx @@ -60,11 +60,9 @@ export interface Props props?: PrimitiveComboboxLabelProps; display?: boolean; }; - groups: Group[]; /** Custom content render override. */ content?: ReactNode; - controlledItems?: Item[]; - setControlledItems?: (items: Item[]) => void; + groups: Group[]; itemIndicator?: boolean; triggerEnabled?: boolean; inputProps?: Omit; @@ -81,8 +79,6 @@ const Combobox = ({ itemIndicator = false, triggerEnabled = true, inputProps, - controlledItems, - setControlledItems, contentProps, controlProps, positionerProps, @@ -111,15 +107,13 @@ const Combobox = ({ item.value.toLowerCase().includes(evt.value.toLowerCase()), ); - controlledItems - ? setControlledItems?.(filtered.length ? filtered : allItems) - : setFilteredItems(filtered.length ? filtered : allItems); + setFilteredItems(filtered.length ? filtered : allItems); }; return ( @@ -164,11 +158,7 @@ const Combobox = ({ {content || groups.map( (group) => - group.items.some((item) => - controlledItems - ? controlledItems.includes(item) - : filteredItems.includes(item), - ) && ( + group.items.some((item) => filteredItems.includes(item)) && ( - (controlledItems - ? controlledItems.includes(item) - : filteredItems.includes(item)) && ( + filteredItems.includes(item) && (